chore: added plugin for automatic importmap generation #393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR improves the management of the import map, which is now generated automatically from the chunks file emitted by rollup, instead of manually doing it.
I added a plugin that runs after Rollup generates the bundle and:
document_head.hbs
template, replacing the existing one.Note: the first step is done with a basic string replace, e.g.
'./a.js'
is replaced with'a'
, and this should cover both static imports (import something from './a.js'
) and dynamic ones (import('./a.js')
). Maybe there is a better way to do it, but I didn't manage to find one.Screenshots
Checklist