Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix: prevent DEBUG env var from crashing ganache #1740

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/packages/ganache/webpack/polyfills/debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const debug = () => () => {};
5 changes: 4 additions & 1 deletion src/packages/ganache/webpack/webpack.browser.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
7 changes: 5 additions & 2 deletions src/packages/ganache/webpack/webpack.common.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
]
};
Expand Down
8 changes: 8 additions & 0 deletions src/packages/ganache/webpack/webpack.node.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down