-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack-config.js
77 lines (74 loc) · 2.26 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
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const WebpackObfuscator = require('webpack-obfuscator');
const {
default: FluentUIReactIconsFontSubsettingPlugin,
} = require('@fluentui/react-icons-font-subsetting-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: "./ui/AppEntry.tsx",
mode: "production",
target: 'web',
externals: [],
output: {
filename: "aibot.min.js",
devtoolModuleFilenameTemplate: '[resource-path]', // removes the webpack:/// prefix
libraryTarget: 'window'
},
resolve: {
extensions: ['.tsx', '.ts', '.js'], // '.ttf', '.woff', '.woff2'],
// Include 'fluentIconFont' to use the font implementation of the Fluent icons
// conditionNames: ['fluentIconFont', 'import']
},
plugins: [
// new FluentUIReactIconsFontSubsettingPlugin(), new NodePolyfillPlugin()
new NodePolyfillPlugin(),
// Include block below only for production build
new WebpackObfuscator ({
rotateStringArray: true
}, ['excluded_bundle_name.js'])
],
module: {
rules: [
{
test: /\.tsx$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'ts-loader',
options: {
configFile: "tsconfig.json"
}
}
},
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'ts-loader',
options: {
configFile: "tsconfig.json"
}
}
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/
},
// Treat the font files as webpack assets
{
test: /\.(ttf|woff2?)$/,
type: 'asset',
}, // Include block below only for production build
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
enforce: 'post',
use: {
loader: WebpackObfuscator.loader,
options: {
rotateStringArray: true
}
}
}
]
}
}