-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
57 lines (54 loc) · 1.9 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
const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const root = path.resolve(__dirname);
const dist = path.join(root, 'public', 'javascripts', 'dist');
const app = path.join(root, 'public', 'javascripts', 'app');
const cesiumSource = path.join(root, 'node_modules', 'cesium', 'Build', 'Cesium');
const cesiumDist = path.join(dist, 'cesium');
const config = {
entry: {
index: path.join(app, 'index.js'), //main
vendor: ['jquery', 'echarts'] //vendors
},
output: {
path: dist,
filename: "[name].js",
},
module: {
rules: [{ //CSS loader
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' }
]
},
//ES6转码,bableloader
{
test: path.join(__dirname, 'public/javascripts/app'),
loader: 'babel-loader',
query: {
presets: 'es2015',
},
}, {
test: /\.(png|gif|jpg|jpeg)$/,
use: [{ loader: 'file-loader' }]
}
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new CopyWebpackPlugin([
{ from: cesiumSource, to: cesiumDist },
]),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
})
],
stats: {
colors: true
},
devtool: false,
}
module.exports = config;