You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.
Describe the bug
Production build fails to compile the following code snippet:
asyncfunctionloadThreeJsLibrary(){[THREE]=awaitPromise.all([import('three')// More import(...)]);// Do something with THREE}voidloadThreeJsLibrary();
Error:
$ vite build
building for production...
Unexpected token
file: /.../vite-project/main.js:10:6
8: async function loadThreeJsLibrary() {
9: [THREE] = await Promise.all([
10: import('three')
^
11: // More import(...)
12: ]);
error during build:
Error: Unexpected token
at error (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:5265:30)
at Module.error (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:9859:16)
at tryParse (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:9740:23)
at Module.setSource (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:10166:19)
at ModuleLoader.addModuleSource (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:18336:20)
at async ModuleLoader.fetchModule (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:18392:9)
at async Promise.all (index 1)
at async ModuleLoader.fetchStaticDependencies (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:18417:34)
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (/.../vite-project/node_modules/rollup/dist/shared/rollup.js:18394:9)
Reproduction
Just add the three package to an empty vanilla vite project and add the lines from above to main.js. Then run yarn build.
Workaround
The build works when extracting the import('three') into a local variable or removing the Promise.all. Since this is just a single occurrence in our code this is not a big issue, but AFAICS this is perfectly valid JS code so it should also compile.
System Info
vite version: 2.0.0-beta.30
Operating System: MacOS
Node version: 14.15.4
Package manager (npm/yarn/pnpm) and version: yarn
The text was updated successfully, but these errors were encountered:
Describe the bug
Production build fails to compile the following code snippet:
Error:
Reproduction
Just add the
three
package to an empty vanilla vite project and add the lines from above to main.js. Then runyarn build
.Workaround
The build works when extracting the
import('three')
into a local variable or removing thePromise.all
. Since this is just a single occurrence in our code this is not a big issue, but AFAICS this is perfectly valid JS code so it should also compile.System Info
vite
version: 2.0.0-beta.30The text was updated successfully, but these errors were encountered: