To build prod, I want my webpack configuration to have two entry points: one for JS and one for SCSS, and I want them to be output in two separate files (one JS, one CSS).
However, extract-text-webpack-plugin creates two JS files and one CSS file; those. the entry point for SCSS creates both the desired CSS file and the JS file that I do not want. This unused JS file contains nothing but the webpack template and // removed by extract-text-webpack-plugin . Therefore, he copes with his task perfectly, but nevertheless creates this unnecessary file. My webpack configuration (showing relevant parts):
const ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { entry: { app: './client/src/app.js', style: './client/src/app.scss' }, output: { path: __dirname + '/server/assets/', publicPath: '/', filename: 'bundle.[chunkhash].js', }, module: { loaders: [{ test: /\.js/, exclude: /node_modules/, include: /src/, loader: 'babel-loader' },{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css', 'sass'), },{ test: /.*\.(woff|woff2|eot|ttf)$/i, loader: "url-loader?limit=10000&mimetype=application/font-woff" },{ test: /.*\.(png|svg|jpg)$/i, loaders: [ 'file?hash=sha512&digest=hex&name=[hash].[ext]', 'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}' ] }] }, plugins: [ new ExtractTextPlugin('bundle.[chunkhash].css', { allChunks: true }) ] };
Thus, in essence, the output creates two .js files, one for each entry, and then the extract plugin creates the actual desired .css file. How can I prevent the output from this unnecessary file?
javascript webpack
artparks
source share