-
-
Notifications
You must be signed in to change notification settings - Fork 779
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (92 loc) · 3.56 KB
/
Copy pathwebpack.config.js
File metadata and controls
96 lines (92 loc) · 3.56 KB
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
const webpack = require("webpack");
const ESLintPlugin = require("eslint-webpack-plugin");
const packageJson = require("./package.json");
const path = require("path");
const settings = require("../../../settings.local.json");
module.exports = (env, argv) => {
const isProduction = argv.mode === "production";
return {
entry: "./src/main.jsx",
optimization: {
minimize: isProduction,
},
output: {
path:
isProduction || settings.WebsitePath === ""
? path.resolve(
"../../Dnn.PersonaBar.Extensions/admin/personaBar/Dnn.AdminLogs/scripts/bundles/"
)
: path.join(
settings.WebsitePath,
"DesktopModules\\Admin\\Dnn.PersonaBar\\Modules\\Dnn.AdminLogs\\scripts\\bundles\\"
),
filename: "adminLogs-bundle.js",
publicPath: isProduction ? "" : "http://localhost:8080/dist/",
},
devServer: {
disableHostCheck: !isProduction,
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
},
},
},
{
test: /\.(less|css)$/,
use: [
{ loader: "style-loader" },
{
loader: "css-loader",
options: {
importLoaders: 1,
sourceMap: true,
modules: {
auto: true,
mode: "global",
localIdentName: "[name]__[local]___[hash:base64:5]",
},
esModule: false,
},
},
{ loader: "less-loader" },
],
},
{ test: /\.(ttf|woff)$/, use: ["url-loader?limit=8192"] },
],
},
resolve: {
extensions: [".js", ".json", ".jsx", ".ts", ".tsx"],
modules: [
path.resolve("./src"), // Look in src first
path.resolve("./node_modules"), // Try local node_modules
path.resolve("../../../node_modules"), // Last fallback to workspaces node_modules
],
},
externals: require("@dnnsoftware/dnn-react-common/WebpackExternals"),
plugins:
[ isProduction
? new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
"process.env": {
NODE_ENV: JSON.stringify("production"),
},
})
: new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
}),
new webpack.SourceMapDevToolPlugin({
filename: "adminLogs-bundle.js.map",
append: "\n//# sourceMappingURL=/DesktopModules/Admin/Dnn.PersonaBar/Modules/Dnn.AdminLogs/scripts/bundles/adminLogs-bundle.js.map"
}),
new ESLintPlugin({fix: true}),
],
devtool: false,
};
};