forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdist.webpack.config.js
More file actions
67 lines (66 loc) · 2.51 KB
/
Copy pathdist.webpack.config.js
File metadata and controls
67 lines (66 loc) · 2.51 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
const webpack = require("webpack");
const ESLintPlugin = require("eslint-webpack-plugin");
const path = require("path");
const packageJson = require("./package.json");
const nodeExternals = require("webpack-node-externals");
module.exports = {
mode: "production",
optimization: {
minimize: true,
},
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "dnn-react-common.min.js",
library: "DnnReactCommon",
libraryTarget: "umd",
},
module: {
rules: [
{ test: /\.(js|jsx)$/, exclude: /node_modules/, use: ["babel-loader"] },
{ test: /\.less$/, use:
[
"style-loader",
{
loader: "css-loader",
options: {
importLoaders: 1,
sourceMap: true,
modules: {
auto: true,
mode: "global",
localIdentName: "[name]__[local]___[hash:base64:5]",
},
esModule: false,
},
},
"less-loader"
]
},
{ test: /\.(ttf|woff)$/, use: ["url-loader?limit=8192"] },
{ test: /\.css$/, use: ["style-loader!css-loader"] },
{ test: /\.(gif|png)$/, use: ["url-loader?mimetype=image/png"] },
{ test: /\.(svg)$/, issuer: /\.[jt]sx?$/, use: ["@svgr/webpack"], },
{ test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, use: ["url-loader?mimetype=application/font-woff"] },
{ test: /\.(ttf|eot)(\?v=[0-9].[0-9].[0-9])?$/, use: ["file-loader?name=[name].[ext]"] }
]
},
externals: ["react", "prop-types", nodeExternals()], // in order to ignore all modules in node_modules folder
resolve: {
extensions: [".js", ".json", ".jsx"],
modules: [
path.resolve(__dirname, "./src"), // Look in src first
path.resolve("./node_modules"), // Try local node_modules
path.resolve("../../../node_modules") // Last fallback to workspaces node_modules
]
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
"process.env": {
"NODE_ENV": JSON.stringify("production")
}
}),
new ESLintPlugin({fix: true}),
]
};