Skip to content
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

Vite production bundling issue #215

Open
dysfunc opened this issue Nov 27, 2023 · 0 comments
Open

Vite production bundling issue #215

dysfunc opened this issue Nov 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@dysfunc
Copy link

dysfunc commented Nov 27, 2023

Describe the bug
When building a production bundle using vite build, the @shopify/prettier-plugin-liquid creates an exception:

RollupError: Identifier "x" has already been declared
    at error (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
    at Module.error (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:12737:16)
    at BlockScope.addDeclaration (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:7520:32)
    at Identifier.declare (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:7188:39)
    at VariableDeclarator.declareDeclarator (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:10178:17)
    at VariableDeclaration.initialise (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:11843:24)
    at new NodeBase (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:4607:14)
    at new VariableDeclaration (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:11815:1)
    at SwitchCase.parseNode (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:4718:27)
    at new NodeBase (file:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:4606:14)

I've created a sample app using stackblitz that reproduces the issue. https://stackblitz.com/edit/vitejs-vite-xivzdt?file=src%2FApp.svelte.

If you run npm run dev, it will compile and work as expected. When you run npm run build, it will try to compile but eventually throws an exception for Identifier "x" has already been declared. I've isolated this issue to this package. If I comment out this package and its usage, my production builds succeed.

@dysfunc dysfunc added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant