-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
68 lines (64 loc) · 1.87 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const JTS = require('jts');
const path = require('path');
const webpack = require('webpack');
// Plugins being used in the webpack build process.
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
var plugins = [
new CleanWebpackPlugin(['dist']),
new CopyWebpackPlugin([
{ context: 'src/assets', from: '**/*', to: 'assets' }
]),
new ExtractTextPlugin('[name].css'),
new JTS({ from: 'src/index.html', to: 'index.html' }),
new webpack.optimize.DedupePlugin(),
new webpack.NoErrorsPlugin()
];
if (process.env.NODE_ENV === 'production') {
plugins.push(new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/,
cssProcessorOptions: { discardComments: { removeAll: true } }
}));
plugins.push(new webpack.optimize.UglifyJsPlugin({
output: {
comments: false
}
}));
}
module.exports = {
entry: {
'assets/app': './src'
},
output: {
path: 'dist',
filename: '[name].js'
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{ test: /\.json$/, loader: 'json' },
{ test: /\.s?css$/, loader: ExtractTextPlugin.extract(['css?-minimize', 'sass']) },
{ test: /\.html$/, loader: 'html' },
{ test: /\.svg$/, loader: 'svg-inline' }
]
},
plugins,
devServer: {
inline: true
},
resolve: {
alias: {
'animate.css': path.resolve(__dirname, './node_modules/animate.css/source')
}
},
sassLoader: {
includePaths: [
path.resolve(__dirname, './node_modules/@treehouse/ui/src'),
path.resolve(__dirname, './node_modules/foundation-sites/scss'),
path.resolve(__dirname, './node_modules/motion-ui')
],
outputStyle: 'expanded'
}
};