From 1e55736c69be838ed160904aa852a140e51869c1 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 25 Feb 2019 11:49:09 -0600 Subject: [PATCH] Move string replacements for node-pty to general --- packages/server/webpack.config.js | 29 ----------------------------- scripts/webpack.general.config.js | 26 ++++++++++++++++++++++---- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/packages/server/webpack.config.js b/packages/server/webpack.config.js index dadbd316..60ab2dd7 100644 --- a/packages/server/webpack.config.js +++ b/packages/server/webpack.config.js @@ -1,39 +1,10 @@ const path = require("path"); const webpack = require("webpack"); const merge = require("webpack-merge"); -const StringReplacePlugin = require("string-replace-webpack-plugin"); -const HappyPack = require("happypack"); module.exports = merge({ devtool: "none", 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: { filename: "cli.js", path: path.join(__dirname, "./out"), diff --git a/scripts/webpack.general.config.js b/scripts/webpack.general.config.js index 7320d606..3edf05ed 100644 --- a/scripts/webpack.general.config.js +++ b/scripts/webpack.general.config.js @@ -91,15 +91,33 @@ module.exports = (options = {}) => ({ loader: "string-replace-loader", options: { 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.*;", replace: "const spdlog = __non_webpack_require__(global.SPDLOG_LOCATION);", 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$/, }, resolve: {