Skip to content

Commit f4c3629

Browse files
committed
chore: make external test pass by manually polyfilling require
1 parent cfdc709 commit f4c3629

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

playground/external/src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
import './require-polyfill'
12
import '@vitejs/test-dep-that-imports'
23
import '@vitejs/test-dep-that-requires'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as vue from 'vue'
2+
import slash3 from 'slash3'
3+
globalThis.require = (dep) => {
4+
if (dep === 'vue') return vue
5+
if (dep === 'slash3') return slash3
6+
throw new Error(`Cannot require "${dep}"`)
7+
}

vitest.config.e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default defineConfig({
1717
'./playground/legacy/**/*.spec.[tj]s', // system format
1818
...(isBuild
1919
? [
20-
'./playground/external/**/*.spec.[tj]s', // https://github.com/rolldown/rolldown/issues/2041
2120
'./playground/object-hooks/**/*.spec.[tj]s', // object hook sequential
2221
'./playground/optimize-deps/**/*.spec.[tj]s', // https://github.com/rolldown/rolldown/issues/2031
2322
'./playground/tsconfig-json/__tests__/**/*.spec.[tj]s', // decorators is not supported by oxc

0 commit comments

Comments
 (0)