Skip to content

Switch to using 'inject: true' and not duplicating upstream functionality #61

@edmorley

Description

@edmorley

The upstream html-webpack-plugin plugin used to include most logic in the actual template file, however in v2.29.0 switched to injecting the relevant markup into the template using JS (see jantimon/html-webpack-plugin@c8a6925).

Currently html-webpack-template must be used with that JS injection mode turned off (inject: false), since it instead re-implements much of the upstream functionality in the custom index.ejs.

This results in a few issues:

  • it breaks the plugin/event functionality of html-webpack-plugin (as noted in FYI: Not compatible with HtmlWebpackInlineChunkPlugin #48), which will become increasingly important as more plugins become available.
  • it means the upstream functionality has to be re-implemented/duplicated here, and this package doesn't automatically benefit from any bug fixes/new features from upstream (which are likely more frequent given the popularity of the upstream package).
  • it means there's a chance for slight behaviour differences for the features that exist both in upstream and this template, which could cause confusion when people switch between the two.

I would propose:

  • updating the docs here to say to use inject: true (this will require a major version bump)
  • removing the parts of index.ejs that are handled upstream, leaving just the custom funcationality

As an added bonus these changes will make it clearer what functionality this custom template adds, and then if in the future any of those features are upstreamed, this package can be simplified even further :-)

Thoughts? (If this sounds like something that would be accepted, I'm happy to open a PR.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions