From 7ed82870521031ca9689cfa38f77b2c304c45fa6 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 7 Feb 2019 23:15:17 -0500 Subject: [PATCH] webpack-node-externals --- package-lock.json | 6 ++++++ package.json | 3 ++- webpack.config.js | 10 +++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 759e6136f3..4bdca2699a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5938,6 +5938,12 @@ } } }, + "webpack-node-externals": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz", + "integrity": "sha512-ajerHZ+BJKeCLviLUUmnyd5B4RavLF76uv3cs6KNuO8W+HuQaEs0y0L7o40NQxdPy5w0pcv8Ew7yPUAQG0UdCg==", + "dev": true + }, "webpack-sources": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", diff --git a/package.json b/package.json index aeee453541..633c099d42 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,8 @@ "tslint-loader": "^3.5.4", "typescript": "3.2.4", "webpack": "^4.29.0", - "webpack-cli": "^3.2.1" + "webpack-cli": "^3.2.1", + "webpack-node-externals": "^1.7.2" }, "dependencies": { "big-integer": "1.6.36", diff --git a/webpack.config.js b/webpack.config.js index 139f7bf980..19a3dfb9d1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path'); const webpack = require('webpack'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); +const nodeExternals = require('webpack-node-externals'); if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'development'; @@ -66,14 +67,9 @@ const config = { filename: '[name].js', path: path.resolve(__dirname, 'build'), }, - module: { - rules: moduleRules, - // ref: https://github.com/socketio/socket.io-client/issues/933 - noParse: /ws/, - }, + module: { rules: moduleRules }, plugins: plugins, - // ref: https://github.com/socketio/socket.io-client/issues/933 - externals: ['ws'], + externals: [nodeExternals()], }; module.exports = config;