Skip to content

Instantly share code, notes, and snippets.

Created March 26, 2017 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2d5e747d5b074a099d95eb54f205e3d5 to your computer and use it in GitHub Desktop.
Save anonymous/2d5e747d5b074a099d95eb54f205e3d5 to your computer and use it in GitHub Desktop.
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