extract-loader
参考:
extract-loader | Webpack [Official]
peerigon/extract-loader: webpack loader to extract HTML and CSS from the bundle – GitHub
使い方
{ test: /\.css$/, use: [ { loader: 'file-loader', options: { name: 'assets/css/[name]-[hash].[ext]' } }, { loader: 'extract-loader', options: { publicPath: (loader) => { '../'.repeat( path.relative( path.resolve('src'), loader.context ).split('/').length ) } } { loader: 'css-loader', options: { sourceMap: true } } ] }
参考: