-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Use esbuild metafile. Add support for 'entryNames' esbuild option. #678
Use esbuild metafile. Add support for 'entryNames' esbuild option. #678
Conversation
… files to pages. This adds support for the 'entryNames' option of esbuild lumeland#678
e87ed9f
to
40a7029
Compare
… files to pages. This adds support for the 'entryNames' option of esbuild lumeland#678
40a7029
to
e835ec5
Compare
… files to pages. This adds support for the 'entryNames' option of esbuild lumeland#678
e835ec5
to
7961d31
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.
Thanks for this! I didn't know the metafile option but it seems very useful!
I just left some comments in the review, some of them are optional. To me, the most sensible part is the change of the output directory, which can break the code.
… files to pages. This adds support for the 'entryNames' option of esbuild lumeland#678
7961d31
to
10e7353
Compare
… files to pages. This adds support for the 'entryNames' option of esbuild lumeland#678
10e7353
to
8620265
Compare
Note that the previous implementation completely ignored the esbuild output path and just wrote it to |
Yeah, to be honest, I hadn't thought about that situation until now! :) |
Description
Currently (before this PR) the esbuild plugin would always output JS asset files as
options.outdir + replaceExtension(page.data.url)
. Which means The esbuild optionentryNames
would not work.Additionally the esbuild plugin tries to map output files from esbuild to lume pages (JS eintry points). This looks similar to this:
When
entryPoints
is set/changed this no longer works. The plugin then can not find a page for the outfile and adds it as a chunk.When using the
entryNames
option like this:Given a source file
scripts/index.ts
you would get something like the following output files:js/index.WSRTVQIK.js
scripts/index.ts
scripts/index.ts
This PR adds support for the
entryPoints
option. It now uses the esbuild metafile which contains information about input and output files and their relation. Using this metafile we can properly map esbuild outfiles to lume pages. It now also uses the esbuild outfile filename as finaldata.url
:The replace is there to support url overwrites via
basename
. Using lume url overwrites in combination with theentryNames
esbuild option works generally. However as we only write the file to a different location to what esbuild intended, JS imports to this file (e.g. via dynamic imports) are not rewritten! Esbuild currently does not offer any functionality to dynamically rewrite an outfile path per file (as far as I know). So this is as much as we can do.I have also mostly reverted the changes from commit 13796a7 as that workaround is no longer necessary.
Related Issues
None
Check List
CODE OF CONDUCT
CONTRIBUTING
send multiple pull request.
fmt
to fix the code format before commit.CHANGELOG.md
.