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

larowlan created an issue. See original summary.

larowlan’s picture

Status: Active » Needs review
StatusFileSize
new3.35 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3230078.patch, failed testing. View results

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB
new3.66 KB
larowlan’s picture

Status: Needs review » Needs work

This needs work to de-duplicate the module files.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new2.7 KB
new4.19 KB

Fixes support for multiple imports

samuel.mortenson’s picture

Interesting - does this work with importing a file that also has an import?

acbramley’s picture

StatusFileSize
new4.16 KB
new381 bytes

does this work with importing a file that also has an import

It does! We can test it by removing the bar.js import as it's imported by foo.js (import of an import)

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

  • larowlan committed 77925e24 on 8.x-1.x authored by acbramley
    Issue #3230078 by larowlan, acbramley, samuel.mortenson: Add support for...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Discussed this with @samuel.mortenson on slack and he was OK with me committing the fix

Will create a new release

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.