This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mode.js
66 lines (63 loc) · 1.62 KB
/
webpack.mode.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
"use strict";
const path = require("path");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const sourceDir = "./src";
module.exports = {
context: path.join(__dirname),
mode: "production",
devtool: "source-map",
output: {
path: path.join(__dirname, "build/mmwpa-mode"),
filename: "[name].js",
chunkFilename: "[id].chunk.js",
// This is a bit strange but it works. The chunks are put in build/prod/lib,
// but the page to load is in build/prod/lib/dashboard. By default the
// chunks are loaded relative to the page, and without a path prefix so the
// browser would look for them in build/prod/lib/dashboard. With "../" it
// looks one directory up.
publicPath: "../",
sourceMapFilename: "[name].map.js",
libraryTarget: "amd",
},
resolve: {
modules: [sourceDir, "node_modules"],
extensions: [".js", ".ts"],
alias: {
wed: path.join(__dirname, "node_modules/wed-demo-lib/wed/lib/wed"),
},
},
entry: {
"mmwpa-mode": ["app/mmwpa-mode/mmwpa-mode.ts"],
},
module: {
rules: [{
test: /\.ts$/,
use: [{
loader: "ts-loader",
options: {
configFile: "src/tsconfig.mode.json",
compilerOptions: {
outDir: "build/mmwpa-mode",
},
},
}],
}],
},
externals: {
require: "require",
wed: "wed",
},
plugins: [
new CopyWebpackPlugin([{
from: {
glob: "mmwpa-mode.css",
},
to: ".",
context: "src/app/mmwpa-mode/",
}]),
new webpack.ProvidePlugin({
platformRequire: "require",
}),
],
};