Skip to content

Using single-spa with webpack hashing? #564

@karfau

Description

@karfau

The recommended setup suggests to not use webpack caching features, since it would be easier to add a commit hash at deployment time.

Since the suggested method will produce new URLs for bundles even though their content didn't change, I would love to know what exactly is required to let webpack create bundles with consistent hashes in the bundle file names.

We are using a monorepo with lerna (currently still v4).

I assume we would need to generate something like an import map for each package the "resolves" the filename with the hash and merge those import maps of the required packages for each root config, but I'm not sure how to access the hash value in the webpack build to create/dump such an import map per package.

Another approach might of course be to calculate and add the hashes to the files after webpack is done, including modifying the import map accordingly.

Any other ideas, or showcases of how it can be done?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions