-
Notifications
You must be signed in to change notification settings - Fork 87
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
Migrate build of single entry points from webpack to vite #4386
Conversation
b6c2e9a
to
87db1e5
Compare
Wrong button.....
EDIT: I can do it myself, that should be faster 🙈, sorry for the ping! |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
PR for rollup: rollup/plugins#1549 Currently I think only the nextcloud-upload library uses rollup? Maybe just migrate to vite there and use the js extension here. |
4216447
to
04ba1d6
Compare
This is a breaking change as this also introduces ESM entry points for all components etc and therfor changed the files from `.js` to `.cjs` and `.mjs` respective. Instead of `import NcButton from '@nextcloud/vue/dist/Components/NcButton.js` use `import NcButton from '@nextcloud/vue/components/NcButton'`. * Also fix docs for component import pattern Co-authored-by: John Molakvoæ <[email protected]> Signed-off-by: Ferdinand Thiessen <[email protected]>
04ba1d6
to
59040a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine and looks fine by configs.
Am I right that now styles are not loaded from .js
but loaded by require('path-to.css')
inside modules?
var r=require("../assets/index45.css");const a=require("../chunks/actionText-bef01778.cjs"),
I'm a bit afraid of it because it is not a correct import/require for module systems, and works only with bundlers. Won't it be broken when dependencies (/node_modules/
) are ignored for css rules or in unit testing (except Vitest)?
P.S. I'm also not fun of putting CSS inside JS as it was before, because it is much worse from a performance perspective. An alternative could be to bundle css in separate, but it would be a breaking change requiring developers to import css implicitly with the component.
A small note about the problem: The css chunk is created in development mode, but for some reason is not imported by the mixin chunk. |
With this PR all dist files will be built using Vite, see todo for rest of webpack.
☑️ Resolves
(previously this PR was breaking, but this is changed):
Because of this I think we should take the opportunity and move from
/dist/Components/...
to simply/components/...
.This will also make it easier when we decide to provide Typescript definitions as then the same layout of dist as of src is used.
So this means you will now need to change the imports:
Benchmark
If you need a reason why this is useful:
text js bundle size decreases by 4% (not much because text mostly imports from main entry point)
but
logreader js bundle size decreases by 27% (-600KiB!).
Migration guide
🚧 Tasks
Webpack is still used by:
vue-docgen
+vitepress
or consider moving to industry standardstorybook
)🏁 Checklist