webpack-node-externals

This commit is contained in:
Kyle Spearrin 2019-02-07 23:15:17 -05:00
parent 6aca111ce0
commit 7ed8287052
3 changed files with 11 additions and 8 deletions

6
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -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;