diff --git a/src/packages/ganache/webpack/polyfills/debug.ts b/src/packages/ganache/webpack/polyfills/debug.ts new file mode 100644 index 0000000000..0b0b8e820c --- /dev/null +++ b/src/packages/ganache/webpack/polyfills/debug.ts @@ -0,0 +1 @@ +export const debug = () => () => {}; diff --git a/src/packages/ganache/webpack/webpack.browser.config.ts b/src/packages/ganache/webpack/webpack.browser.config.ts index ecaefbc2e5..d1939e7f91 100644 --- a/src/packages/ganache/webpack/webpack.browser.config.ts +++ b/src/packages/ganache/webpack/webpack.browser.config.ts @@ -35,7 +35,10 @@ const config: webpack.Configuration = merge({}, base, { // mcl-wasm may be needed when creating a new @ethereumjs/vm and requires a browser version for browsers "mcl-wasm": require.resolve("mcl-wasm/browser"), // ws doesn't work in the browser, isomorphic-ws does - ws: require.resolve("isomorphic-ws/") + ws: require.resolve("isomorphic-ws/"), + // we don't use the debug module internally, so let's just not include it + // in any package. + debug: require.resolve("./polyfills/debug") } }, output: { diff --git a/src/packages/ganache/webpack/webpack.common.config.ts b/src/packages/ganache/webpack/webpack.common.config.ts index 499ce8ac91..ea8f29a2c0 100644 --- a/src/packages/ganache/webpack/webpack.common.config.ts +++ b/src/packages/ganache/webpack/webpack.common.config.ts @@ -72,9 +72,12 @@ const base: webpack.Configuration = { ] }, plugins: [ - new webpack.DefinePlugin({ + new webpack.EnvironmentPlugin({ // replace process.env.INFURA_KEY in our code - "process.env.INFURA_KEY": JSON.stringify(INFURA_KEY) + INFURA_KEY, + // replace process.env.DEBUG in our code, because we don't use it but + // ethereumjs packages do, but we don't implement everything required + DEBUG: false }) ] }; diff --git a/src/packages/ganache/webpack/webpack.node.config.ts b/src/packages/ganache/webpack/webpack.node.config.ts index 308648da5d..ab193dea7c 100644 --- a/src/packages/ganache/webpack/webpack.node.config.ts +++ b/src/packages/ganache/webpack/webpack.node.config.ts @@ -14,6 +14,14 @@ const config: webpack.Configuration = merge({}, base, { filename: "[name].js", path: path.resolve(__dirname, "../", "dist", "node") }, + resolve: { + extensions: [".ts", ".js"], + alias: { + // we don't use the debug module internally, so let's just not include it + // in any package. + debug: require.resolve("./polyfills/debug") + } + }, plugins: [ // add a shebang at the top of the generated `cli.js` new webpack.BannerPlugin({