-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
71 lines (69 loc) · 1.55 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
var webpack = require('webpack')
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const cesiumBuild = 'node_modules/cesium/Build/Cesium';
module.exports = {
entry: './src/index.js',
output: {
filename: 'js/[name].bundle.js',
path: path.resolve(__dirname, 'web')
},
devtool: 'cheap-module-eval-source-map',
devServer: {
contentBase: './web'
},
module: {
rules: [{
test: /\.(js)$/i,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
}, {
test: /\.(jpg|png|gif)$/i,
use: {
loader: "url-loader",
options: {
name: '[name].[ext]',
outputPath: './css/images/'
}
}
}, {
test: /\.(zip)/i,
use: {
loader: "file-loader",
options: {
name: '[name].[ext]',
outputPath: './data/'
}
}
}, {
test: /\.css$/,
use: ['style-loader', {
loader: 'css-loader',
options: {
minimize: true
}
}]
}]
},
plugins: [
new CleanWebpackPlugin(['web']),
new htmlWebpackPlugin({
template: './src/index.html'
}),
new CopyPlugin([{from: path.join(__dirname, cesiumBuild), to: 'Cesium'}]),
new CopyPlugin([{from: path.join(__dirname, 'src/data'), to: 'Data'}])
]
};