-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
73 lines (72 loc) · 2.15 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const webpack = require("webpack");
const path = require("path");
module.exports = {
entry: "./src/js/main.js",
output: {
path: path.resolve(__dirname),
filename: "./dist/[name].bundle.js",
publicPath: "/wp-content/plugins/hashpress-core/",
},
devServer: {
static: {
directory: path.join(__dirname, "/"),
},
},
mode: "development",
devtool: false,
resolve: {
extensions: [".js"],
fallback: {
// buffer: require.resolve("buffer/"), // Path to the buffer module
// stream: require.resolve("stream-browserify"), // Fallback for stream
// process: require.resolve("process/browser.js"), // Fallback for process
// https: require.resolve(`https-browserify`),
// http: require.resolve(`stream-http`),
// crypto: false,
// http2: false,
// // stream: false,
// util: false,
// path: false,
// os: false,
// fs: false,
// dns: false,
// net: false,
// zlib: false,
// url: false,
// tls: false,
},
},
plugins: [
// new webpack.ProvidePlugin({
// process: "process/browser.js", // Polyfill for process
// Buffer: ["buffer", "Buffer"], // Polyfill for Buffer if needed
// }),
],
module: {
rules: [
// {
// test: /\.ts$/, // Load TypeScript files
// use: "ts-loader",
// exclude: /node_modules/,
// },
// {
// test: /\.js$/,
// exclude: /node_modules/,
// use: "babel-loader",
// },
],
},
optimization: {
splitChunks: {
chunks: "all", // Split all chunks
cacheGroups: {
default: false, // Disable the default 'commons' chunk
vendors: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all",
},
},
},
},
};