-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.js
48 lines (46 loc) · 1.1 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
import path from "path";
import { fileURLToPath } from "url";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
devtool: "source-map",
entry: "./src/bakery.ts",
mode: "production",
experiments: {
outputModule: true,
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "bakery.js",
library: {
type: "module",
},
},
resolve: {
extensions: ["", ".ts", ".js"],
fallback: {
buffer: require.resolve("buffer/"),
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
util: require.resolve("util/"),
},
},
module: {
rules: [
{ test: /\.ts$/, loader: "ts-loader" },
{ test: /\.js$/, loader: "source-map-loader" },
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
};