-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
109 lines (106 loc) · 2.46 KB
/
webpack.config.babel.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
const webpack2 = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
const postCssClassPrefix = require('postcss-class-prefix');
const paths = require('./configs/paths');
const NODE_ENV = process.env.NODE_ENV.trim();
const isDevelopment = NODE_ENV === 'development';
module.exports = {
entry: {
'ca-debug': "./src/js/index.js",
'engage': "./src/js/modules/engage/engage-module.js"
},
output: {
publicPath: './',
filename: '[name].js'
},
devtool: false,
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|dist)/,
enforce: 'pre',
loaders: ['eslint-loader']
},
{
test: /\.ts$/,
exclude: /(node_modules|dist)/,
enforce: 'pre',
loader: 'tslint-loader'
},
{
test: /\.js$/,
exclude: /(node_modules|dist)/,
use: {
loader: 'babel-loader'
}
},
{
test: /.ts?$/,
exclude: /(node_modules|dist)/,
loaders: ['babel-loader', 'ts-loader']
},
{
test: /\.pug$/,
use: ['pug-loader?pretty=true']
},
{
test: /\.scss$/,
use: [{
loader: 'style-loader'
},{
loader: 'css-loader'
}, {
loader: 'postcss-loader'
}, {
loader: 'sass-loader'
}]
}
]
},
watch: isDevelopment,
watchOptions: {
aggregateTimeout: 300
},
plugins: [
new webpack2.NoEmitOnErrorsPlugin(),
new webpack2.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV),
VERSION: JSON.stringify(require("./package.json").version)
}),
new webpack2.LoaderOptionsPlugin({
minimize: !isDevelopment,
debug: false,
options: {
postcss: [
autoprefixer({
browsers: ['last 2 version', 'Explorer >= 8']
}),
postCssClassPrefix('ce-')
],
sassLoader: {
includePaths: [
path.resolve(__dirname, 'node_modules/sanitize.css/')
]
}
}
}),
new webpack2.ProvidePlugin({
'_': 'underscore'
})
],
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.ts', '.scss']
},
resolveLoader: {
modules: ['node_modules'],
extensions: ['.js'],
moduleExtensions: ['-loader']
}
};
if (!isDevelopment) {
module.exports.entry['ca'] = './src/js/index.js';
module.exports.entry['es5-shim'] = 'aight/aight.min';
}