generated from vivid-lapin/ts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack-prebuild.config.ts
60 lines (58 loc) · 1.6 KB
/
webpack-prebuild.config.ts
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
import path from "path"
import { ESBuildMinifyPlugin } from "esbuild-loader"
import { LicenseWebpackPlugin } from "license-webpack-plugin"
import webpack from "webpack"
import PostProcessPlugin from "./PostProcessPlugin"
const config: webpack.Configuration = {
entry: {
"recoil-sync-loader": "./src/recoil-sync-loader.js",
"recoil-loader": "./src/recoil-loader.js",
"react-loader": "./src/react-loader.js",
},
mode: "production",
output: {
libraryTarget: "commonjs",
path: path.resolve(__dirname, "dist"),
},
devtool: "source-map",
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "esbuild-loader",
options: {
loader: "tsx",
target: "es2018",
},
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
fallback: {
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
crypto: require.resolve("crypto-browserify"),
querystring: require.resolve("querystring-es3"),
stream: require.resolve("stream-browserify"),
path: require.resolve("path-browserify"),
url: require.resolve("url"),
process: require.resolve("process"),
buffer: require.resolve("buffer"),
},
},
plugins: [
new LicenseWebpackPlugin() as never,
new PostProcessPlugin(),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
],
optimization: {
splitChunks: false,
minimizer: [new ESBuildMinifyPlugin({ target: "es2018" })],
},
}
export default config