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 3.0 generate different code between development and production #9191

Closed
7 tasks done
IWANABETHATGUY opened this issue Jul 18, 2022 · 3 comments
Closed
7 tasks done
Labels
feat: commonjs @rollup/plugin-commonjs issue inconsistency Inconsistency between dev & build

Comments

@IWANABETHATGUY
Copy link

Describe the bug

  1. run pnpm dev and open the browser render below
    image
  2. run pnpm build and live-server dist render below:
    image

Reproduction

https://github.com/IWANABETHATGUY/vite-codegen-issue

System Info

Binaries:
    Node: 18.2.0 - /tmp/fnm_multishells/188949_1658144339703/bin/node
    Yarn: 1.22.19 - ~/.local/share/pnpm/yarn
    npm: 8.9.0 - /tmp/fnm_multishells/188949_1658144339703/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 102.0.1
  npmPackages:
    vite: ^3.0.0 => 3.0.1

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red
Copy link
Member

It worked correctly when you opt-in esbuild deps optimization at build time.
https://vitejs.dev/guide/migration.html#using-esbuild-deps-optimization-at-build-time

Also it worked with 3.0.0-beta.2 but didn't work with 3.0.0-beta.3.
https://stackblitz.com/edit/github-rfkfeg?file=package.json,main.js,vite.config.js
Maybe @rollup/plugin-commonjs v22 is affecting this (#8743).

@bluwy bluwy added bug inconsistency Inconsistency between dev & build and removed pending triage labels Jul 20, 2022
@sapphi-red sapphi-red added the feat: commonjs @rollup/plugin-commonjs issue label Jul 27, 2022
@sapphi-red
Copy link
Member

Closing as I confirmed this is already fixed in 3.0.9.

@IWANABETHATGUY
Copy link
Author

Thanks

@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: commonjs @rollup/plugin-commonjs issue inconsistency Inconsistency between dev & build
Projects
None yet
Development

No branches or pull requests

3 participants