-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.common.js
66 lines (66 loc) · 2.05 KB
/
webpack.common.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
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
let webpackCommon = {
entry: {
"docxyz.umd": "./src/index.js",
},
devtool: "source-map",
output: {
filename: "[name].js",
globalObject: 'this',
library: {
name: "docxyz",
type: "umd",
//export: 'default'
},
},
module: {
rules: [
{
//test: /\.js$/,
//include: [path.resolve(__dirname, "./src")],
test: /\.(js|mjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
use: {
loader: "babel-loader",
options: {
sourceType: 'unambiguous',
presets: ["@babel/preset-env"],
//plugins:[["@babel/plugin-proposal-class-properties", { "loose": true }]]
}
}
}
]
},
resolve: {
fallback: {
fs: false,
events: require.resolve('events/'),
crypto: require.resolve('crypto-browserify'),
path: require.resolve('path-browserify'),
//url: require.resolve('url'),
buffer: require.resolve('buffer/'),
//util: require.resolve('util/'),
stream: require.resolve('stream-browserify/'),
constants: require.resolve("constants-browserify"),
//vm: require.resolve('vm-browserify'),
zlib: require.resolve("browserify-zlib"),
console: require.resolve("console-browserify")
}
},
plugins: [new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})],
mode: "none",
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
test: /\.min\.js$/,
}),
],
},
}
module.exports = webpackCommon;