quasar/app-vite has problem with (some) CJS module resolution #13002
-
I have some quite big app which works well with webpack. App is built without any error. After changing 👍
and module.export to export in klijenti.js, it works again. I have the problem only with my modules (not with all and not with npm modules) Another problem is that I have node_modules in two layers.
For some common modules (not all) there is build error. After flattening (moving common modules to local), everything works again |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is the nature of Vite itself. It doesn't do AST analysis (one of the reasons it's so fast), so mixing ESM with CJS doesn't plays well. In any case, it's outside of our reach. If you really can't transform CJS to ESM, then maybe you're better off with q/app-webpack. Or maybe there is a Vite plugin to handle this (albeit doing it will have a perf penalty for sure). |
Beta Was this translation helpful? Give feedback.
This is the nature of Vite itself. It doesn't do AST analysis (one of the reasons it's so fast), so mixing ESM with CJS doesn't plays well. In any case, it's outside of our reach. If you really can't transform CJS to ESM, then maybe you're better off with q/app-webpack. Or maybe there is a Vite plugin to handle this (albeit doing it will have a perf penalty for sure).