8000 🐛 Fail to inject code-splitting script files when webpack 4 optimization.splitChunks.name: false · Issue #878 · jantimon/html-webpack-plugin · GitHub
[go: up one dir, main page]

Skip to content
🐛 Fail to inject code-splitting script files when webpack 4 optimization.splitChunks.name: false #878
@dwiyatci

Description

@dwiyatci

Description

As @sokra suggested in one of webpack 4 posts to preserve long term caching:

or switch off name generation via optimization.splitChunks.name: false

html-webpack-plugin somehow fails to inject the generated "splitted" files when I apply this option in combination with output: { filename: '[name].[chunkhash].js' }.

Config

module.exports = {
  mode: 'production',
  output: {
    filename: '[name].[chunkhash].js',
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.ejs',
      favicon: './src/favicon.ico',
    }),
  ],
  optimization: {
    splitChunks: {
      chunks: 'all',
      name: false,
    },
    runtimeChunk: true,
  },
};

Template file:

<!DOCTYPE html>
<html>
    <head>
        <title>My App</title>
    </head>
    <body>
        <div id="app"></div>
    </body>
</html>

Relevant Links

Environment

Node.js v8.9.0
darwin 15.6.0
npm 5.5.1
webpack 4.0.1
html-webpack-plugin 3.0.4

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

      0