-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (46 loc) · 1.14 KB
/
Copy pathwebpack.config.js
File metadata and controls
52 lines (46 loc) · 1.14 KB
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
const path = require('path');
const webpack = require('webpack');
const BabiliPlugin = require("babili-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const APP_DIR = path.resolve(__dirname, 'src');
const entries = {
training: './src/entry-training.js',
engineering: './src/entry-engineering'
}
const babiliPlugin = new BabiliPlugin();
const extractSassPlugin = new ExtractTextPlugin({ filename: "main.css"});
module.exports = (env) => ({
entry: {
main: entries[env.AUDIENCE]
},
output: {
filename: 'bundle.js',
path: __dirname + '/pub'
},
module : {
loaders : [{
test : /\.jsx?/,
include : APP_DIR,
use : 'babel-loader'
} ,{
test: /\.scss$/,
use: extractSassPlugin.extract({
use: [
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
})
}]
},
resolve: {
extensions: ['.js', '.scss', '.jsx'],
alias: {
['~']: APP_DIR
}
},
devServer: {
inline: true,
hot: true
},
plugins: env.NODE_ENV==='production' ? [babiliPlugin, extractSassPlugin] : [extractSassPlugin]
});