Closed himself65 closed 7 months ago
/Users/himself65/Library/Caches/fnm_multishells/85522_1705359274939/bin/npm run build
> vite-issue@1.0.0 build
> node ./build.js
vite v5.0.11 building for production...
✓ 3 modules transformed.
Unexpected eof (Note that you need plugins to import files that are not JavaScript)
file: /Users/himself65/Code/vite-issue/node_modules/@code-hike/lighter/dist/onig.wasm?module:1:5
1: asm�```````````` ``...
^
2:
3:
node:internal/process/esm_loader:40
internalBinding('errors').triggerUncaughtException(
^
Error [RollupError]: Unexpected eof
at error (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
... 6 lines matching cause stack trace ...
at async ModuleLoader.addModuleSource (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/node-entry.js:17760:13) {
cause: Error [RollupError]: Unexpected eof
at error (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
at nodeConverters (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:2084:9)
at convertNode (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:969:12)
at convertProgram (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:960:48)
at parseAstAsync (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/parseAst.js:2150:20)
at async Module.tryParseAsync (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/node-entry.js:13514:21)
at async Module.setSource (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/node-entry.js:13095:35)
at async ModuleLoader.addModuleSource (file:///Users/himself65/Code/vite-issue/node_modules/rollup/dist/es/shared/node-entry.js:17760:13) {
code: 'PARSE_ERROR',
pos: 5
},
code: 'PARSE_ERROR',
id: '/Users/himself65/Code/vite-issue/node_modules/@code-hike/lighter/dist/onig.wasm?module',
pos: 5,
loc: {
column: 5,
file: '/Users/himself65/Code/vite-issue/node_modules/@code-hike/lighter/dist/onig.wasm?module',
line: 1
},
frame: '1: \x00asm\x01\x00\x00\x00\x01�\x01\x16`\x02\x7F\x7F\x01\x7F`\x01\x7F\x01\x7F`\x03\x7F\x7F\x7F\x01\x7F`\x04\x7F\x7F\x7F\x7F\x01\x7F`\x01\x7F\x00`\x05\x7F\x7F\x7F\x7F\x7F\x01\x7F`\x03\x7F\x7F\x7F\x00`\x02\x7F\x7F\x00`\x06\x7F\x7F\x7F\x7F\x7F\x7F\x01\x7F`\x07\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x01\x7F`\x00\x01\x7F`\t\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x01\x7F`\b\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x01\x7F`\x00\x00`\x04...\n' +
' ^\n' +
'2: \x01\x00\x01\x00\x03\x03\x02\x00\x00\x02\x06\x02\x0E\x02\x01\x0F\x01\x01\x01\n' +
'3: \x13\x02\x05\t\x06\x01\x0E\x14\x15\x10\x07\x03\x02\x01\x00\x01\x04',
watchFiles: [
'/Users/himself65/Code/vite-issue/src/index.ts',
'/Users/himself65/Code/vite-issue/package.json',
'/Users/himself65/Code/vite-issue/node_modules/@code-hike/lighter/dist/worker.esm.mjs',
'/Users/himself65/Code/vite-issue/node_modules/@code-hike/lighter/dist/onig.wasm'
]
}
Node.js v20.10.0
Process finished with exit code 1
Seems the package is importing WASM with ?module
, which won't be handled by this plugin...
is this expected?
Yes. It's ignored since it has the unexpected suffix ?module
, which in non-standard (notice my log prefixed with *****
):
However, after patching the package to remove the ?module
suffix, it still fails to build:
The WASM file, treated as ES Module, is requesting a non-existing module import env
.
We can see that it's not following WebAssembly ESM integration. So, it's not suitable for this plugin.
Related: https://github.com/code-hike/lighter/issues/35