-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
63 lines (60 loc) · 1.58 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
var assign = require('lodash.assign');
var path = require('path');
var webpack = require('webpack');
var PATHS = {
BUILD: path.join(__dirname, 'build', process.env.DEPLOY_TIMESTAMP || ''),
LIB: path.join(__dirname, 'lib'),
SOURCE: path.join(__dirname, 'src')
};
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractSass = new ExtractTextPlugin('main.css');
var config = {
entry: {
main: [path.join(PATHS.SOURCE, 'index.js')],
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.scss$/,
loader: extractSass.extract('style', ['css', 'postcss', 'sass', 'import-glob'])
}
]
},
postcss: [
require('autoprefixer')
],
resolve: {
alias: {
lib: PATHS.LIB,
src: PATHS.SOURCE
},
extensions: ['', '.js']
},
output: {
filename: 'main.bundle.js',
path: PATHS.BUILD,
publicPath: '/joeandliana/'
},
plugins: [
extractSass,
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
};
var devConfig = assign({}, config, {
entry: [
'webpack-hot-middleware/client'
].concat(config.entry.main),
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
].concat(config.plugins)
});
module.exports = config;
module.exports.devConfig = devConfig;