Skip to content

Commit

Permalink
fix: remove polyfill for process in the bundle
Browse files Browse the repository at this point in the history
A polyfill for Node.js "process" was included in the final bundle.

Reference: https://webpack.js.org/configuration/node/
  • Loading branch information
darrachequesne committed Feb 2, 2021
1 parent 47f917a commit 61afc5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions support/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ module.exports = {
},
mode: "development",
devtool: "source-map",
node: {
Buffer: false,
},
node: false,
module: {
rules: [
{
Expand Down
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require("./support/env");
const { browser } = require("./support/env");

// whitelist some globals to avoid warnings
if (global.mocha) {
global.mocha.globals(["___eio", "eio_iframe_*"]);
if (browser) {
window.mocha.globals(["___eio", "eio_iframe_*"]);
}

require("./url.ts");
Expand Down
4 changes: 2 additions & 2 deletions test/support/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// we only do this in our tests because we need to test engine.io-client
// support in browsers and in node.js
// some tests do not yet work in both
exports.browser = !!global.window;
exports.browser = typeof window !== "undefined";
exports.node = !exports.browser;

if (!global.location) {
if (exports.node) {
global.location = {
protocol: "http:",
host: "localhost:3210",
Expand Down

0 comments on commit 61afc5d

Please sign in to comment.