forked from node-opcua/node-opcua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpackDLL.config.js
95 lines (90 loc) · 2.83 KB
/
webpackDLL.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"use strict";
const webpack = require("webpack");
const path = require("path");
const nodeExternals = require("webpack-node-externals");
const babiliWebpackPlugin = require("babili-webpack-plugin");
const MinifyPlugin = require("babel-minify-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
// -------------------------------------------------------------
//
// -------------------------------------------------------------
const config = {
target: "node",
//xx context: __dirname,
entry: ["./packages/node-opcua/dist/index.js"],
devtool: "source-map",
output: {
path: path.resolve(path.join(__dirname, "dist")),
//xx library: "vendor_lib_[hash]",
libraryTarget: "commonjs",
filename: "node-opcua.bundle.min.js"
},
node: {
__dirname: false, // not original dirname
fs: "empty",
net: "empty",
child_process: "empty"
},
externals: [nodeExternals({
whitelist: [/.*/,/opcua/]
})],
// "spawn-sync", "camelcase", "string-width", "read-pkg-up", "os-locale", "memcpy", "yargs", "ursa", "usage", "require-main-filename"],
// module: {
// rules: [
// {
// test: /\.js$/,
// //xx exclude: [/node_modules/],
// loader: "babel-loader",
// query: {
// presets: ["es2015"],
// },
// }
// ]
// },
plugins: [
// new webpack.DllPlugin({
// //xx context: __dirname,
// path: path.join(__dirname, "dist", "opcua-manifest.json"),
// name: "opcua_[hash]"
// })
// new MinifyPlugin({}/*minifyOpts*/, {}/*pluginOpts*/)
// new webpack.optimize.UglifyJsPlugin({
// minimize: true,
// compress:true
// })
new babiliWebpackPlugin ({
mangle:false,// { "topLevel": false },
deadcode: true
}, {
comments: false
}),
new CopyWebpackPlugin([
// {output}/file.txt
{
to: path.resolve(path.join(__dirname, "dist/nodesets/")),
from: "packages/node-opcua-nodesets/nodesets/" }
])
]
};
const configMax = {
target: "node",
//xx context: __dirname,
entry: ["./packages/node-opcua/dist/index.js"],
devtool: "source-map",
output: {
path: path.resolve(path.join(__dirname, "dist")),
//xx library: "vendor_lib_[hash]",
libraryTarget: "commonjs",
filename: "node-opcua.bundle.js"
},
node: {
__dirname: false, // not original dirname
fs: "empty",
net: "empty",
child_process: "empty"
},
externals: [nodeExternals({
whitelist: [/.*/,/opcua/]
})]
};
module.exports = [ config , configMax ];