-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
94 lines (71 loc) · 2.01 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
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
/**
* Bundle config
*/
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var StyleLintPlugin = require('stylelint-webpack-plugin');
var entryFiles = {
'js' : './src/js/main.js',
'css' : 'main.css',
};
var outputFiles = {
'js' : './codex-special.min.js',
// 'css' : './codex-special.min.css',
};
module.exports = {
entry: entryFiles['js'],
output: {
filename: outputFiles['js'],
library: 'codexSpecial',
libraryTarget: 'umd'
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'css-loader?uglify=1&importLoaders=1!postcss-loader'
// ExtractTextPlugin.extract('css-loader?uglify=1&importLoaders=1!postcss-loader'),
},
{
test : /\.js$/,
loader: 'eslint-loader'
}
]
},
/**
* PostCSS configuration
*/
postcss: function () {
return [
/** Allows using CSSnet for included files */
require('postcss-smart-import'),
/** Allows using future capabilities: variables, functions */
require('postcss-cssnext'),
];
},
plugins: [
/** Minify CSS and JS */
new webpack.optimize.UglifyJsPlugin({
/** Disable warning messages. Cant disable uglify for 3rd party libs such as html-janitor */
compress: {
warnings: false
}
}),
/** Block build if errors found */
new webpack.NoErrorsPlugin(),
/** Put CSS into external bundle */
// new ExtractTextPlugin(outputFiles['css']),
/** Check CSS code style */
new StyleLintPlugin({
context : './src/css/',
files : entryFiles['css'],
}),
],
devtool: 'source-map',
/** Auto rebuld */
watch: true,
watchOptions: {
/** Timeout before build */
aggragateTimeout: 50
}
};