-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Project build failed with "import.meta.env" #3304
Comments
Vite encountered the Related code:
vite/packages/vite/src/node/plugins/define.ts Lines 40 to 49 in 792a6e1
|
Thanks,I solved the problem. |
Glad it helped. But technically it's still a bug, so I need to reopen this issue. |
Any chance a solution has been found for this? I'm noticing this with a SvelteKit + MDsveX site. It's essentially making it so I can't write any blog posts with the string |
The fix could probably be done together with #6295, but it's a hard bug to fix. Ideally if const bla = `hmm ${import.meta.env}` makes things a lot harder, unless we do a full parse in build. |
Similar problem with Reproduction:
<template>
<div>Hello process.env.NODE_ENV</div>
</template>
It points to the line with broken quotes function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return (_openBlock(), _createElementBlock("div", null, "Hello "development""))
} |
@WesleyXuZzz @sodatea Have you solved this problem? I got the same error message when I trying to build my react project. |
@Qwertovsky Although very similar, this issue and yours have different causes. I reported your issue in #9829. |
Instead of doing a string replace, can we leverage esbuild's define to only replace code? |
Describe the bug
Project build failed
Reproduction
Repo: https://github.com/WesleyXuZzz/vue3-vite-ts-vant3
System Info
Optional:
Installed vue version (from yarn.lock or package-lock.json) ^3.0.5
Installed @vue/compiler-sfc version ^3.0.5
Logs (Optional if provided reproduction)
[rollup-plugin-dynamic-import-variables] Unexpected token (3:15)
vue3-vite-ts-vant3/src/utils/request.ts:3:15
error during build:
SyntaxError: Unexpected token (3:15)
The text was updated successfully, but these errors were encountered: