Skip to content

Commit 1e55736

Browse files
committed
Move string replacements for node-pty to general
1 parent 80d9baa commit 1e55736

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

packages/server/webpack.config.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
11
const path = require("path");
22
const webpack = require("webpack");
33
const merge = require("webpack-merge");
4-
const StringReplacePlugin = require("string-replace-webpack-plugin");
5-
const HappyPack = require("happypack");
64

75
module.exports = merge({
86
devtool: "none",
97
mode: "development",
10-
module: {
11-
rules: [
12-
{
13-
test: /@oclif\/command\/lib\/index\.js/,
14-
loader: StringReplacePlugin.replace({
15-
replacements: [
16-
{
17-
// This is required otherwise it attempts to require("package.json")
18-
pattern: /checkNodeVersion\(\)\;/,
19-
replacement: () => / /,
20-
}
21-
]
22-
}),
23-
},
24-
{
25-
test: /node\-pty\/lib\/index\.js/,
26-
loader: StringReplacePlugin.replace({
27-
replacements: [
28-
{
29-
pattern: /exports\.native.*;/,
30-
replacement: () => "exports.native = null;",
31-
}
32-
]
33-
}),
34-
},
35-
],
36-
},
378
output: {
389
filename: "cli.js",
3910
path: path.join(__dirname, "./out"),

scripts/webpack.general.config.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,33 @@ module.exports = (options = {}) => ({
9191
loader: "string-replace-loader",
9292
options: {
9393
multiple: [{
94-
// These will be handled by file-loader. We need the location because
95-
// they are parsed as URIs and will throw errors if not fully formed.
96-
// The !! prefix causes it to ignore other loaders (doesn't work).
9794
search: "const spdlog.*;",
9895
replace: "const spdlog = __non_webpack_require__(global.SPDLOG_LOCATION);",
9996
flags: "g",
10097
}],
10198
},
102-
},],
99+
}, {
100+
// This is required otherwise it attempts to require("package.json")
101+
test: /@oclif\/command\/lib\/index\.js/,
102+
loader: "string-replace-loader",
103+
options: {
104+
multiple: [{
105+
search: "checkNodeVersion\\(\\);",
106+
replace: "",
107+
flags: "g",
108+
}],
109+
},
110+
}, {
111+
test: /node\-pty\/lib\/index\.js/,
112+
loader: "string-replace-loader",
113+
options: {
114+
multiple: [{
115+
search: "exports\\.native.*;",
116+
replace: "exports.native = null;",
117+
flags: "g",
118+
}],
119+
},
120+
}],
103121
noParse: /\/test\/|\.test\.jsx?|\.test\.tsx?|tsconfig.+\.json$/,
104122
},
105123
resolve: {

0 commit comments

Comments
 (0)