-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
56 lines (54 loc) · 1.35 KB
/
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
49
50
51
52
53
54
55
56
const webpack = require("webpack");
const path = require("path");
const tsconfig = require("./tsconfig.json");
tsconfig.compilerOptions.target = "es5";
tsconfig.compilerOptions.outDir = "web";
module.exports = {
entry: {NarLoader: "./lib/NarLoader.ts"},
output: {
library: "narLoader",
libraryTarget: "umd",
path: path.resolve("."),
filename: "web/lib/[name].js",
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: "webpack-espower-loader",
},
{
loader: "ts-loader",
options: {compilerOptions: tsconfig.compilerOptions},
},
],
exclude: /node_modules/,
},
],
noParse: /browserfs\.js/,
},
resolve: {
extensions: [
".ts",
".js",
],
alias: {
"fs": "browserfs/dist/shims/fs.js",
"buffer": "browserfs/dist/shims/buffer.js",
"path": "browserfs/dist/shims/path.js",
"processGlobal": "browserfs/dist/shims/process.js",
"bufferGlobal": "browserfs/dist/shims/bufferGlobal.js",
"bfsGlobal": require.resolve("browserfs"),
},
},
node: {
process: false,
Buffer: false,
},
plugins: [
new webpack.ProvidePlugin({BrowserFS: "bfsGlobal", process: "processGlobal", Buffer: "bufferGlobal"}),
],
devtool: "source-map",
};