-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
52 lines (51 loc) · 1.46 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
"use strict";
const webpack = require("webpack");
const HtmlPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
require("dotenv").config({ path: './.env'})
module.exports = (_env, args) => ({
mode: args.mode === "production" ? "production" : "development",
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
plugins: args.mode === "production" ? [] : [],
}
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|gif|jpg|jpeg|svg|xml|json)$/,
use: ["url-loader"],
},
],
},
plugins: [
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify(""),
"process.env": JSON.stringify(process.env)
}),
new CopyPlugin({
patterns: [
{ from: "node_modules/cesium/Build/Cesium/Workers", to: "Workers" },
{ from: "node_modules/cesium/Build/Cesium/ThirdParty", to: "ThirdParty" },
{ from: "node_modules/cesium/Build/Cesium/Assets", to: "Assets" },
{ from: "node_modules/cesium/Build/Cesium/Widgets", to: "Widgets" },
],
}),
new HtmlPlugin({
template: "index.html"
}),
...(args.mode === "production" ? [] : []),
],
});