Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var webpack = require('webpack');
var inProduction = (process.env.NODE_ENV === 'production');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var path = require('path');
module.exports = {
entry: {
general: [
'./src/js/general.js',
'./src/scss/general.scss'
]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
new webpack.LoaderOptionsPlugin({
minimize: inProduction
})
]
};
if (inProduction) {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin()
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.