Created
March 26, 2017 19:05
-
-
Save anonymous/2d5e747d5b074a099d95eb54f205e3d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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