-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·103 lines (101 loc) · 1.79 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
95
96
97
98
99
100
101
102
103
const path = require('path');
const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: './src/index.js',
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
},
exclude: [
'/example-consumer/'
]
},
{
test: /\.scss|css$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
],
exclude: [
'/example-consumer/'
]
},
{
test: /\.(png|gif|jpg|svg)$/,
use: {
loader: 'url-loader',
options: {
limit: 50000,
},
},
exclude: [
'/example-consumer/'
]
},
{
test: /.js$/,
enforce: "pre",
include: path.resolve(__dirname, cesiumSource),
use: [
{
loader: "strip-pragma-loader",
options: {
pragmas: {
debug: false,
},
},
},
],
exclude: [
'/example-consumer/'
]
}
],
},
resolve: {
extensions: ['.scss', '.js', '.json', '.png', '.gif', '.jpg', '.svg'],
alias: {
cesium$: 'cesium/Cesium',
cesium: 'cesium/Source'
}
},
plugins: [
new CopyWebpackPlugin([
{
from: path.join(cesiumSource, cesiumWorkers),
to: "Workers",
},
{
from: path.join(cesiumSource, "Assets"),
to: "Assets",
},
{
from: path.join(cesiumSource, "Widgets"),
to: "Widgets",
},
]),
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify(""),
}),
],
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: '',
filename: 'cesium-react-library.js',
libraryTarget: 'umd',
sourcePrefix: ''
},
amd: {
toUrlUndefined: true
},
node: {
fs: 'empty'
}
};