Describe the bug
Script parsing chash, on the line of this type:
<sonething>.process.env.<sonething>
Reproduction
- Setup vanilla Vite project
- Put to
main.js:
const foo = {
process: {env: {FOO: 'BAR'}},
};
console.log(foo.process.env.FOO);
- Run build:
npm run build
- I got error:
[rollup-plugin-dynamic-import-variables] Unexpected token (5:16)
file: .../main.js:5:16
error during build:
SyntaxError: Unexpected token
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Memory: 4.51 GB / 15.42 GB
Binaries:
Node: 16.3.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.15.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.423.0), Chromium (91.0.864.41)
Internet Explorer: 11.0.19041.1
npmPackages:
vite: ^2.3.5 => 2.3.6
Used package manager: npm
Logs
Details
$ npm run build
> build
> vite build
vite v2.3.6 building for production...
✓ 1 modules transformed.
[rollup-plugin-dynamic-import-variables] Unexpected token (5:16)
file: C:/Users/kozac/Dev/vite-issue-with-global-syntax/main.js:5:16
error during build:
SyntaxError: Unexpected token (5:16)
at Parser.pp$4.raise (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:16748:13)
at Parser.pp.unexpected (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:14258:8)
at Parser.pp$3.parseIdent (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:16679:10)
at Parser.pp$3.parseSubscript (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15970:28)
at Parser.pp$3.parseSubscripts (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15939:24)
at Parser.pp$3.parseExprSubscripts (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15923:21)
at Parser.pp$3.parseMaybeUnary (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15886:17)
at Parser.pp$3.parseExprOps (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15819:19)
at Parser.pp$3.parseMaybeConditional (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15802:19)
at Parser.pp$3.parseMaybeAssign (C:\Users\kozac\Dev\vite-issue-with-global-syntax\node_modules\rollup\dist\shared\rollup.js:15770:19)
Before submitting the issue, please make sure you do the following
Describe the bug
Script parsing chash, on the line of this type:
Reproduction
main.js:npm run buildSystem Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:System: OS: Windows 10 10.0.19042 CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics Memory: 4.51 GB / 15.42 GB Binaries: Node: 16.3.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.15.1 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (91.0.864.41) Internet Explorer: 11.0.19041.1 npmPackages: vite: ^2.3.5 => 2.3.6Used package manager: npm
Logs
Details
Before submitting the issue, please make sure you do the following