From c96ce22639022695483923058e80cb1319e9bc53 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 18 Jun 2020 08:30:02 +0300 Subject: [PATCH] use webpack-node-externals Signed-off-by: Jari Kolehmainen --- package.json | 2 ++ webpack.main.ts | 11 ++++------- yarn.lock | 12 ++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9dc9e4cc85..8b4c6de551 100644 --- a/package.json +++ b/package.json @@ -234,6 +234,7 @@ "@types/webdriverio": "^4.13.0", "@types/webpack": "^4.41.17", "@types/webpack-dev-server": "^3.11.0", + "@types/webpack-node-externals": "^1.7.1", "ace-builds": "^1.4.11", "ansi_up": "^4.0.4", "babel-core": "^7.0.0-beta.3", @@ -300,6 +301,7 @@ "vuex": "^3.4.0", "webpack": "^4.43.0", "webpack-cli": "^3.3.11", + "webpack-node-externals": "^1.7.2", "xterm": "^4.6.0", "xterm-addon-fit": "^0.4.0" } diff --git a/webpack.main.ts b/webpack.main.ts index 9bfbef3675..551371f565 100755 --- a/webpack.main.ts +++ b/webpack.main.ts @@ -2,6 +2,7 @@ import path from "path"; import webpack from "webpack"; import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin" import { isDevelopment, isProduction, mainDir, outDir } from "./src/common/vars"; +import nodeExternals from "webpack-node-externals"; export default function (): webpack.Configuration { return { @@ -24,13 +25,9 @@ export default function (): webpack.Configuration { __dirname: false, __filename: false, }, - // fixme: this will hide warnings during compilation, but creates runtime error - // externals: [ - // "@kubernetes/client-node", - // "handlebars", - // "node-pty", - // "ws", - // ], + externals: [ + nodeExternals + ], module: { rules: [ { diff --git a/yarn.lock b/yarn.lock index df8070c545..58d192e941 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2231,6 +2231,13 @@ "@types/serve-static" "*" "@types/webpack" "*" +"@types/webpack-node-externals@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@types/webpack-node-externals/-/webpack-node-externals-1.7.1.tgz#73d0d7ae0e98cfbd69b7443388302cd69217494a" + integrity sha512-kbO2gYPKvMb5j1KOgnIuUH52CKul9Ud4b10J5n+JX8oHmgu86hYpBVfrV4bMDe5lhCaO64h8QrKz7WnRZzqkbA== + dependencies: + "@types/webpack" "*" + "@types/webpack-sources@*": version "1.4.0" resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-1.4.0.tgz#e58f1f05f87d39a5c64cf85705bdbdbb94d4d57e" @@ -11494,6 +11501,11 @@ webpack-cli@^3.3.11: v8-compile-cache "2.0.3" yargs "13.2.4" +webpack-node-externals@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz#6e1ee79ac67c070402ba700ef033a9b8d52ac4e3" + integrity sha512-ajerHZ+BJKeCLviLUUmnyd5B4RavLF76uv3cs6KNuO8W+HuQaEs0y0L7o40NQxdPy5w0pcv8Ew7yPUAQG0UdCg== + webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"