-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
70 lines (63 loc) · 1.76 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
const webpack = require('webpack');
const NODE_ENV = process.env.NODE_ENV || 'development';
const NODE_HOST = process.env.NODE_HOST || '0.0.0.0';
const NODE_PORT = process.env.NODE_PORT || 8090;
module.exports = {
entry: getEntrySources(['./src/jquery.autoscrollTextTape.js']),
output: {
path: __dirname + '/dist/',
publicPath: "/dist", //assets data
filename: 'jquery.autoscrollTextTape.min.js'
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style-loader!css-loader',
exclude: [/node_modules/, /public/]
},
{
test: /\.js$/,
loader: 'babel',
query: {
presets: ["es2015"]
}
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
devServer: {
host: NODE_HOST,
port: NODE_PORT,
colors: true,
debug: true,
hot: true,
devtool: true,
historyApiFallback: true,
"eval-source-map": true,
"eval-source-map": true,
inline: true,
contentBase: __dirname + '/test',
},
};
if (NODE_ENV == 'production') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: false,
unsafe: true
}
})
);
}
function getEntrySources(sources) {
if (process.env.NODE_ENV !== 'production') {
sources.unshift(`webpack-dev-server/client?http://${NODE_HOST}:${NODE_PORT}`);
sources.unshift('webpack/hot/only-dev-server');
}
return sources;
}