diff --git a/README.md b/README.md index 14eae8f..50851f7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ imported in ESM files, regardless of whether they're imported statically or dynamically. ```js -import Hook from 'import-in-the-middle' +import { Hook } from 'import-in-the-middle' import { foo } from 'package-i-want-to-modify' console.log(foo) // whatever that module exported diff --git a/index.js b/index.js index 50a8665..50aa04f 100644 --- a/index.js +++ b/index.js @@ -89,5 +89,6 @@ Hook.prototype.unhook = function () { } module.exports = Hook +module.exports.Hook = Hook module.exports.addHook = addHook module.exports.removeHook = removeHook diff --git a/test/hook/dynamic-import.js b/test/hook/dynamic-import.js index 1d012f1..a466a1d 100644 --- a/test/hook/dynamic-import.js +++ b/test/hook/dynamic-import.js @@ -2,7 +2,7 @@ // // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. -const Hook = require('../../index.js') +const { Hook } = require('../../index.js') const { strictEqual } = require('assert') Hook((exports, name) => { diff --git a/test/hook/static-import-default.mjs b/test/hook/static-import-default.mjs index 304224b..2c6982a 100644 --- a/test/hook/static-import-default.mjs +++ b/test/hook/static-import-default.mjs @@ -2,7 +2,7 @@ // // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. -import Hook from '../../index.js' +import { Hook } from '../../index.js' import barMjs from '../fixtures/something.mjs' import barJs from '../fixtures/something.js' import { strictEqual } from 'assert'