-
-
Notifications
You must be signed in to change notification settings - Fork 364
[LiveComponent] Adding rollup to make an esm build #111
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
Conversation
external: [ | ||
/@babel\/runtime/, | ||
/core-js\//, | ||
'stimulus', | ||
], |
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.
In the Rollup world we usually automate external
by using the following code:
import pkg from './package.json';
export default [
{
// ...
external: Object.keys(pkg.dependencies)
}
]
WDYT?
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.
I want to do whatever is standard :). But, the @babel/runtime
needed to be a regex so that it matches all the individual, nested paths that are actually imported - like @babel/runtime/...
. I got that from the note in this section - https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers
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.
Oh alright, I wasn't aware of that
@@ -1,16 +1,17 @@ | |||
{ | |||
"name": "@symfony/live-stimulus", | |||
"description": "Live Component: bring server-side re-rendering & model binding to any element.", | |||
"main": "dist/live_controller.js", | |||
"main": "dist/live-controller.esm.js", |
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.
Do you think it would be interesting to also configure module
field?
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.
Even though they're identical, yea, I think that's a good idea.
This PR was merged into the main branch. Discussion ---------- [bug] remove duplicated doctrine/annotations entry | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | n/a | License | MIT Looks like 2 different PR's added this. (#111 and #106) Commits ------- 5b9ea2d [bug] remove duplicated doctrine/annotations entry
This PR was merged into the main branch. Discussion ---------- [bug] remove duplicated doctrine/annotations entry | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | n/a | License | MIT Looks like 2 different PR's added this. (symfony/ux#111 and symfony/ux#106) Commits ------- 5b9ea2d [bug] remove duplicated doctrine/annotations entry
Bug A
from #102Hi!
This changes how LiveComponent is bundle. There are a few important pieces:
I decided to continue support IE 11. The difference in the unminified file size (including polyfills) is about 5kg (56kb vs 61kb).
I'm building ESM only right now. I have considered a UMD build... but I don't know if there is a real use-case. In practice, this library will always be used in a build system... but I cannot find any other libraries that only output ESM.
This sets
babelHelpers
toruntime
, which means that instead of embedding the babel helpers (like_typeof
ux/src/LiveComponent/assets/dist/live_controller.js
Line 3 in e239983
@babel/runtime
.We're testing the
src/
files, not thedist/
files.I don't have a lot of experience with compiling files for the frontend - and there seems to be a lot of variability on how to do it. If you see anything weird, let me know :).
Cheers!