Move string replacements for node-pty to general
This commit is contained in:
parent
80d9baadc0
commit
1e55736c69
|
@ -1,39 +1,10 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const merge = require("webpack-merge");
|
const merge = require("webpack-merge");
|
||||||
const StringReplacePlugin = require("string-replace-webpack-plugin");
|
|
||||||
const HappyPack = require("happypack");
|
|
||||||
|
|
||||||
module.exports = merge({
|
module.exports = merge({
|
||||||
devtool: "none",
|
devtool: "none",
|
||||||
mode: "development",
|
mode: "development",
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /@oclif\/command\/lib\/index\.js/,
|
|
||||||
loader: StringReplacePlugin.replace({
|
|
||||||
replacements: [
|
|
||||||
{
|
|
||||||
// This is required otherwise it attempts to require("package.json")
|
|
||||||
pattern: /checkNodeVersion\(\)\;/,
|
|
||||||
replacement: () => / /,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /node\-pty\/lib\/index\.js/,
|
|
||||||
loader: StringReplacePlugin.replace({
|
|
||||||
replacements: [
|
|
||||||
{
|
|
||||||
pattern: /exports\.native.*;/,
|
|
||||||
replacement: () => "exports.native = null;",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
output: {
|
output: {
|
||||||
filename: "cli.js",
|
filename: "cli.js",
|
||||||
path: path.join(__dirname, "./out"),
|
path: path.join(__dirname, "./out"),
|
||||||
|
|
|
@ -91,15 +91,33 @@ module.exports = (options = {}) => ({
|
||||||
loader: "string-replace-loader",
|
loader: "string-replace-loader",
|
||||||
options: {
|
options: {
|
||||||
multiple: [{
|
multiple: [{
|
||||||
// These will be handled by file-loader. We need the location because
|
|
||||||
// they are parsed as URIs and will throw errors if not fully formed.
|
|
||||||
// The !! prefix causes it to ignore other loaders (doesn't work).
|
|
||||||
search: "const spdlog.*;",
|
search: "const spdlog.*;",
|
||||||
replace: "const spdlog = __non_webpack_require__(global.SPDLOG_LOCATION);",
|
replace: "const spdlog = __non_webpack_require__(global.SPDLOG_LOCATION);",
|
||||||
flags: "g",
|
flags: "g",
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
},],
|
}, {
|
||||||
|
// This is required otherwise it attempts to require("package.json")
|
||||||
|
test: /@oclif\/command\/lib\/index\.js/,
|
||||||
|
loader: "string-replace-loader",
|
||||||
|
options: {
|
||||||
|
multiple: [{
|
||||||
|
search: "checkNodeVersion\\(\\);",
|
||||||
|
replace: "",
|
||||||
|
flags: "g",
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
test: /node\-pty\/lib\/index\.js/,
|
||||||
|
loader: "string-replace-loader",
|
||||||
|
options: {
|
||||||
|
multiple: [{
|
||||||
|
search: "exports\\.native.*;",
|
||||||
|
replace: "exports.native = null;",
|
||||||
|
flags: "g",
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}],
|
||||||
noParse: /\/test\/|\.test\.jsx?|\.test\.tsx?|tsconfig.+\.json$/,
|
noParse: /\/test\/|\.test\.jsx?|\.test\.tsx?|tsconfig.+\.json$/,
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|
Loading…
Reference in New Issue