-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-api.config.js
57 lines (54 loc) · 1.27 KB
/
webpack-api.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
const webpack = require ("webpack");
const CopyPlugin = require ("copy-webpack-plugin");
const fs = require ("fs");
const ppath = require ("path");
const packageStr = fs.readFileSync (process.cwd () + "/package.json").toString ();
const packageJSON = JSON.parse (packageStr);
let packageVersion = packageJSON.version.toString ();
module.exports = {
entry: "./src/WebExport.ts",
devtool: "inline-source-map",
target: "web",
module: {
rules: [{
test: new RegExp ("\.tsx?$"),
use: [{
loader: "ts-loader",
options: {
transpileOnly: true,
configFile: "tsconfig-web.json"
}
}],
exclude: /node_modules/
}]
},
plugins: [
new webpack.DefinePlugin ({
__VERSION__: `\"${packageVersion}\"`
}),
new CopyPlugin ({
patterns: [
{ from: `${process.cwd ()}/build-web/admin-panel.js`,
to: `${process.cwd ()}/public/js/admin-panel.js` }
]
})
],
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
node: {
fs: "empty",
crypto: "empty",
stream: "empty",
Utils: "empty"
},
externals: {
hotstaq: "HotStaqWeb"
},
output: {
filename: "admin-panel.js",
path: ppath.resolve (process.cwd (), "build-web"),
library: "admin-panelWeb",
libraryTarget: "umd"
}
};