Skip to content

Commit

Permalink
Make solcjs compilation work when Hardhat is bundled
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Dec 8, 2022
1 parent dd9c3dc commit 968a58f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/hardhat-core/src/internal/solidity/compiler/index.ts
Expand Up @@ -41,6 +41,14 @@ export class Compiler implements ICompiler {
*/
private _loadCompilerSources(compilerPath: string) {
const Module = module.constructor as any;

// if Hardhat is bundled (for example, in the vscode extension), then
// Module._extenions might be undefined. In that case, we just use a plain
// require.
if (Module._extensions === undefined) {
return require(compilerPath);
}

const previousHook = Module._extensions[".js"];

Module._extensions[".js"] = function (
Expand Down

0 comments on commit 968a58f

Please sign in to comment.