-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix module entry point by migrating to vite for ESM building #4276
Conversation
649b09e
to
593eb34
Compare
Cannot we make a full migration to Vite? I'm a bit afraid of having 2 (almost 3) different bundlers at the same time in terms of config support. |
I think the goal is to do a step-by-step migration :) |
That was / is my plan, but currently it does not work out that good because styleguide does not work that well with vite currently (see #2959 and #3529 and #3565 ). (edit:)
Exactly from those three previous PRs I know that doing all in one is quite hard and error prone, so doing it step by step seems to be the best way :) |
2b3b728
to
63b6ede
Compare
715e67f
to
78c6026
Compare
178fc7e
to
c7a5273
Compare
c7a5273
to
96663e6
Compare
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* Webpack emitted invalid ES module code, as it still contained `require` calls which are undefined on ES modules * Build time is much shorter * Built assets are much smaller (570 kB vs 930 kB) * Remove unneeded import Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…pack and cypress When imported in vite config it will be executed in ESM context where dynamic require of modules is not available. But when converted to ES module it works in vite config + webpack config, but not in Cypress config. Because our package type is `commonjs` so Typescript files are executed as CommonJS Typescript, so the Cypress config can not require "import" an ES module. Solutions: Either set out package to `type: "module"` or as done here rewrite all require calls to dynamic import which is available on CommonJS *and* ES module. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
96663e6
to
eafc329
Compare
☑️ Resolves
This introduces vite for building the module entry point instead of webpack.
require
instead ofimport
which is not defined for ES modules.(Different from #3529 as this just introduces vite for module building to fix the assets)
🏁 Checklist