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
When upgrading from 1.2.7 to 1.3.x, I got the following error:
[vite] Internal server error: Cannot use 'import.meta' outside a module (1:0)
Further inspection, the error comes from using the lib acorn, saying that "import.meta" can't be used on scripts.
I am using a vite project with hmr. When running vite dev, vite will inject import.meta.hot in the compiled bundle. es-module-lexer will read the bundle and extract all imports, including import.meta.*. When you call acorn parse, you don't specify the sourceType, and the default value to that is 'script'. When it catches 'import.meta', it will throw this error.
Reverting to 1.2.7 solves this problem.
Possible solution would be to pass sourceType value as option of acorn.
The text was updated successfully, but these errors were encountered:
When upgrading from 1.2.7 to 1.3.x, I got the following error:
[vite] Internal server error: Cannot use 'import.meta' outside a module (1:0)
Further inspection, the error comes from using the lib acorn, saying that "import.meta" can't be used on scripts.
I am using a vite project with hmr. When running vite dev, vite will inject import.meta.hot in the compiled bundle. es-module-lexer will read the bundle and extract all imports, including import.meta.*. When you call acorn parse, you don't specify the sourceType, and the default value to that is 'script'. When it catches 'import.meta', it will throw this error.
Reverting to 1.2.7 solves this problem.
Possible solution would be to pass sourceType value as option of acorn.
The text was updated successfully, but these errors were encountered: