Problem/Motivation
If you use Javascript modules with chunk-splitting via a bundler like rollup or webpack, then the imported files are not considered when generating a static file-set
Steps to reproduce
Write modern Javascript and use a bundler like rollup or webpack to package up your JS into chunks.
Include an entry point via a libraries.yml file
Run tome static
Note that the static files include the entry point, but not any of the chunks that the browser imports via the import directive
Proposed resolution
This is not dissimilar to url imports in CSS files, so we should be able to do this in a similar fashion
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
larowlanComment #4
larowlanComment #5
larowlanThis needs work to de-duplicate the module files.
Comment #6
larowlanFixes support for multiple imports
Comment #7
samuel.mortensonInteresting - does this work with importing a file that also has an import?
Comment #8
acbramley commentedIt does! We can test it by removing the bar.js import as it's imported by foo.js (import of an import)
Comment #9
larowlanThis is ready in my book and is blocking #3271913: Don't bother with file copies during build, keep file paths on the build and deploy from the original file
Comment #11
larowlanDiscussed this with @samuel.mortenson on slack and he was OK with me committing the fix
Will create a new release