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 #375

Open
dysfunc opened this issue Nov 27, 2023 · 1 comment
Open

Vite production bundling issue #375

dysfunc opened this issue Nov 27, 2023 · 1 comment
Labels
area:prettier-plugin Bug Something isn't working moderate lowest severity for theme related bug

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:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
    at Module.error (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:12737:16)
    at BlockScope.addDeclaration (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:7520:32)
    at Identifier.declare (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:7188:39)
    at VariableDeclarator.declareDeclarator (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:10178:17)
    at VariableDeclaration.initialise (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:11843:24)
    at new NodeBase (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:4607:14)
    at new VariableDeclaration (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:11815:1)
    at SwitchCase.parseNode (file:https:///Library/WebServer/Documents/opensense/node_modules/rollup/dist/es/shared/node-entry.js:4718:27)
    at new NodeBase (file:https:///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
@jamesmengo jamesmengo transferred this issue from Shopify/prettier-plugin-liquid Jun 20, 2024
@jamesmengo
Copy link
Contributor

Hey @dysfunc,
Thanks for raising this - I Just wanted to confirm whether this is still an issue!

@jamesmengo jamesmengo added moderate lowest severity for theme related bug and removed untriaged labels Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:prettier-plugin Bug Something isn't working moderate lowest severity for theme related bug
Projects
None yet
Development

No branches or pull requests

2 participants