vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
67.96k stars 6.12k forks source link

2.7.0+ production mode issue #6099

Closed jzs11 closed 2 years ago

jzs11 commented 2 years ago

Describe the bug

After upgrading to 2.7.0+, the production mode site is broken

image

Reproduction

Sry, I can not share my repo, here is the package.json

"dependencies": { "@vitejs/plugin-vue": "2.0.0", "@vuelidate/core": "^2.0.0-alpha.14", "@vuelidate/validators": "^2.0.0-alpha.13", "@vueuse/core": "^7.2.2", "@vueuse/integrations": "^7.2.2", "@vueuse/router": "^7.2.2", "chart.js": "^3.6.2", "core-js": "^3.19.3", "devextreme": "^21.2.4", "devextreme-aspnet-data-nojquery": "^2.8.4", "devextreme-vue": "^21.2.4", "lodash": "^4.17.21", "primeflex": "^3.0.0", "primeicons": "^5.0.0", "primevue": "^3.10.0", "prismjs": "^1.15.0", "universal-cookie": "^4.0.4", "vite": "2.7.2", "vite-plugin-checker": "^0.3.4", "vite-plugin-eslint": "^1.3.0", "vue": "^3.2.24", "vue-router": "^4.0.12", "vue-tsc": "^0.3.0", "vue-word-highlighter": "^1.0.4", "vuedraggable": "^4.1.0", "@vicons/fa": "^0.11.0", "@vicons/utils": "^0.1.4" }, "devDependencies": { "@types/jest": "^27.0.3", "@types/lodash": "4.14.178", "@types/prismjs": "^1.16.5", "@vue/compiler-sfc": "^3.2.24", "@vue/eslint-config-airbnb": "^6.0.0", "@vue/eslint-config-typescript": "^9.0.0", "sass": "^1.44.0", "typescript": "^4.4.3" }

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 18.97 GB / 31.73 GB
  Binaries:
    Node: 17.0.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.53)
    Internet Explorer: 11.0.22000.120

Used Package Manager

npm

Logs

No response

Validations

jzs11 commented 2 years ago

Downgrade to 2.6.14 fix the issue

github-actions[bot] commented 2 years ago

Hello @jzs11. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

marklai1998 commented 2 years ago

This also happened to me with e$e is not a function

I have a minimal react setup and it only breaks in production

image

patak-dev commented 2 years ago

Please create a repro using https://vite.new/react or upload it as a repo in github

marklai1998 commented 2 years ago

I was able to solve it after some trial and error I turned on sourcemap and serve it in local, the error is coming from @babel/runtime fn missing Install that resolve the problem

Still not sure why it only happens after 2.7.0

jzs11 commented 2 years ago

I was able to solve it after some trial and error I turned on sourcemap and serve it in local, the error is coming from @babel/runtime fn missing Install that resolve the problem

Still not sure why it only happens after 2.7.0

Do you mean install the @babel/runtime in the npm packages?

marklai1998 commented 2 years ago

I was able to solve it after some trial and error I turned on sourcemap and serve it in local, the error is coming from @babel/runtime fn missing Install that resolve the problem Still not sure why it only happens after 2.7.0

Do you mean install the @babel/runtime in the npm packages?

yes, but just my case, if it doesn't work for you you can turn on source map and debug it in dev tools

jzs11 commented 2 years ago

I was able to solve it after some trial and error I turned on sourcemap and serve it in local, the error is coming from @babel/runtime fn missing Install that resolve the problem Still not sure why it only happens after 2.7.0

Do you mean install the @babel/runtime in the npm packages?

yes, but just my case, if it doesn't work for you you can turn on source map and debug it in dev tools

Thanks dude, not my case. It really a show stopper for us to upgrade to 2.7 for vite. 😌

jzs11 commented 2 years ago

Is this fixed @Shinigami92 ? Thanks

Shinigami92 commented 2 years ago

Oh, I read the comments and thought https://github.com/vitejs/vite/issues/6099#issuecomment-994215514 solved it. Will open, sry for confusion.

But still needs a minimal repro, otherwise it will close automatically in few days.

jzs11 commented 2 years ago

Oh, I read the comments and thought #6099 (comment) solved it. Will open, sry for confusion.

Thanks dude, I am trying to get a repo up when I have time.

jzs11 commented 2 years ago

@Shinigami92 here is the repo - https://github.com/jzs11/vite-2.7/

Navigate into a workbook under the dev mode should not experience any errors image

Then try npm run build npm run serve

You will see the error in the dev tool (Not exactly the same as the one I experienced, but it should give you something to start)

Downgrade the Vite into 2.6.14, the problem is gone.

Also, if you have time possible also take a look at another problem in v2.7.0 image

It is no longer respect the charset: false rule when publish.

Thanks, Jing

m430 commented 2 years ago

I use react with vite@2.7.4, in development anything is right, but when I run npm run build, it broken. I think maybe it is because some modules is use commonjs require, so I add the @rollup/plugin-commonjs, but it doesn't work.

alfeg commented 2 years ago

@Shinigami92 have same issue and provided a repro https://github.com/vitejs/vite/issues/6061

Shinigami92 commented 2 years ago

So closing this in favor of #6061 :+1: