-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
117 lines (115 loc) · 2.89 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const webpack = require("webpack");
const pfDir = path.dirname(
require.resolve("@patternfly/patternfly/package.json")
);
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: "./src/builder/entry.tsx",
output: {
filename: "index.js",
path: path.resolve(__dirname, "uiBuilder"),
libraryTarget: "umd",
library: "patternfly-builder",
},
externals: {
vscode: "commonjs vscode",
},
resolve: {
extensions: [".js", ".ts", ".tsx"],
fallback: {
stream: require.resolve("stream-browserify"),
util: require.resolve("util/"),
https: require.resolve("https-browserify"),
http: require.resolve("stream-http"),
path: require.resolve("path-browserify"),
crypto: require.resolve("crypto-browserify"),
zlib: require.resolve("browserify-zlib"),
assert: require.resolve("assert/"),
fs: false,
},
},
devServer: {
port: 8085,
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: "ts-loader",
options: {},
},
{
test: /\.css$/,
use: [
{
loader: "style-loader",
},
{
loader: "css-loader",
},
],
},
{
test: /\.css$/i,
oneOf: [
{
include: /\/monaco-editor\//,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
use: "null-loader",
},
],
},
{
test: /\.(png|jpg|svg)$/i,
use: [
{
loader: "url-loader",
options: {
limit: 8192,
},
},
],
},
// {
// test: /\.(png|jpe?g|webp|gif|svg)$/,
// loader: "null-loader"
// },
// {
// test: /.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
// loader: "null-loader"
// },
],
},
plugins: [
new HTMLWebpackPlugin({ template: "src/builder/index.html" }),
new CopyPlugin({
patterns: [
{ from: path.join(pfDir, "patternfly.css"), to: "" },
{ from: path.join(pfDir, "patternfly-addons.css"), to: "" },
{ from: path.join(pfDir, "assets"), to: "assets" },
{ from: path.join(__dirname, "src/builder/styles.css"), to: "" },
],
}),
new MonacoWebpackPlugin({
languages: ["javascript", "typescript", "html", "xml"],
}),
new MiniCssExtractPlugin(),
new webpack.ProvidePlugin({
process: "process/browser",
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
],
// performance: {
// hints: false,
// },
};