Name webpack chunks from react-loadable

后端 未结 1 1591
花落未央
花落未央 2021-02-12 18:20

I\'ve successfully added react-loadable library in my project to enable code splitting, the only problem I\'ve found is that the chunks generated by webpack are not named, they

相关标签:
1条回答
  • 2021-02-12 18:52

    Ok, after 4 days I found the solution. I needed to add the chunkFilename line to my webpack config:

    output: {
      path: path.join(__dirname, './../public'),
      filename: 'bundle.js',
      publicPath: '/',
      chunkFilename: '[name].[chunkhash].js'
    },
    

    Then it works. I found it in the webpack github page


    EDIT:

    Addtional information for substitutions can be found in the webpack documentation for output.chunkFilename and for output.filename

    0 讨论(0)
提交回复
热议问题