-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@vitejs/plugin-legacy does not build #14634
Comments
This is caused by the following code, inlined in const makeWorker = () => new Worker_1(async (terserPath, code, options) => {
// test fails when using `import`. maybe related: https://github.com/nodejs/node/issues/43205
// eslint-disable-next-line no-restricted-globals -- this function runs inside cjs
const terser = require(terserPath);
return terser.minify(code, options);
}); The problem is that |
How to solve it? |
A temporary hack - const terser = require(terserPath);
+ const terser = eval('require')(terserPath); Locate the line and do a codemod yourself, persist it with patch-package if you must to. But I think there are more to fix. The script tag in html didn't seem to be generated correctly. The type is 'module' even it is a systemjs module instead of esm. And the entry runs before polyfill so the 'System' variable is not found. (Did one of nuxt plugin reordered them?) |
any update? |
1 similar comment
any update? |
hi i install with
next remove node_module dir and lock file, but again error! |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Please take this issue seriously |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
After testing, this issue doesn't replicate in latest nuxt (3.2.2). The project can be built and ran successfully with @vitejs/plugin-legacy. I can see the legacy scripts included in the browser Raising this error in the console here's reproduction: https://stackblitz.com/edit/github-8lcbw5?file=nuxt.config.ts
update: found a related issue here #15464 this one should be closed |
Great. Closing in favour of #15464. |
Environment
Linux
v16.14.2
3.0.0-rc.8
npm@7.17.0
vite
vite
-
-
Reproduction
https://stackblitz.com/edit/github-qzrpnn?file=nuxt.config.ts
Describe the bug
When adding the Vite plugin
@vitejs/plugin-legacy
and trying to build usingnuxt build
I get an error.The error does not happen when using a clean Vite project, so I guess it is related to Nuxt.
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: