forked from dnnsoftware/Dnn.React.Common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist.webpack.config.js
48 lines (47 loc) · 1.85 KB
/
dist.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
const webpack = require("webpack");
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)$/, enforce: "pre", exclude: /node_modules/, loader: "eslint-loader", options: { fix: true } },
{ test: /\.(js|jsx)$/, exclude: /node_modules/, loaders: ["babel-loader"] },
{ test: /\.less$/, loader: "style-loader!css-loader!less-loader" },
{ test: /\.(ttf|woff)$/, loader: "url-loader?limit=8192" },
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.(gif|png)$/, loader: "url-loader?mimetype=image/png" },
{ test: /\.(svg)$/, loader: "raw-loader" },
{ test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?mimetype=application/font-woff" },
{ test: /\.(ttf|eot)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader?name=[name].[ext]" }
]
},
target: "node", // in order to ignore built-in modules like path, fs, etc.
externals: ["react", "prop-types", nodeExternals()], // in order to ignore all modules in node_modules folder
resolve: {
extensions: [".js", ".json", ".jsx"],
modules: [
"node_modules",
path.resolve(__dirname, "src")
]
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
"process.env": {
"NODE_ENV": JSON.stringify("production")
}
})
]
};