Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript setup Error: Rewiremock: there is no "parent module". Is there two HotModuleReplacementPlugins? #138

Open
jamlen opened this issue Jul 29, 2022 · 0 comments

Comments

@jamlen
Copy link

jamlen commented Jul 29, 2022

I'm trying to use rewiremock after converting from using rewire in a typescript project.

// ./rewiremock.ts
import rewiremock, {addPlugin, plugins} from 'rewiremock'

rewiremock.overrideEntryPoint(module) // this is important. This command is "transfering" this module parent to rewiremock
addPlugin(plugins.nodejs)
// we need webpack aliases
addPlugin(plugins.webpackAlias)
// and all stub names would be a relative
addPlugin(plugins.relative)
// and all stubs should be used. Lets make it default!
addPlugin(plugins.usedByDefault)

export { rewiremock }

// ./test/demo.test.ts
import { rewiremock } from '../rewiremock'

Even just importing is enough for the error to occur.

This has the same error as #137 but a different environment and setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant