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

babel/plugin-transform-typescript and rewire #229

Open
Ranjeet-Naidu opened this issue Dec 19, 2019 · 1 comment
Open

babel/plugin-transform-typescript and rewire #229

Ranjeet-Naidu opened this issue Dec 19, 2019 · 1 comment

Comments

@Ranjeet-Naidu
Copy link

Hi guys the babel plugin rewire doesn't seem to work with babel 7. Has this issue been previously raised?

"@babel/core": "^7.7.4",
"babel-plugin-rewire": "^1.2.0"

In karma config

{
  test: /\.(js|jsx|ts|tsx)$/,
  exclude: [/app\/lib/, /node_modules/],
  use: [
    {
      loader: 'babel-loader',
      options: {
        presets: ['@babel/preset-env'],
        plugins: ['rewire']
      }
    }
  ]
}

This problem is likely caused by another plugin injecting "_RewireAPI__" without registering it in the scope tracker. If you are the author of that plugin, please use "scope.registerDeclaration(declarationPath)". The exported identifier "_RewireAPI__" is not declared in Babel's scope tracker as a JavaScript value binding, and "@babel/plugin-transform-typescript" never encountered it as a TypeScript type declaration. It will be treated as a JavaScript value.

@Ranjeet-Naidu Ranjeet-Naidu changed the title babel/plugin-transform-typescript and babel-plugin-rewire babel/plugin-transform-typescript and rewire Dec 19, 2019
@TranquilMarmot
Copy link

TranquilMarmot commented Jun 29, 2020

This has been driving us crazy and we'd love to see a fix for it! It does seem like this project is dead, though. We're working on switching to Jest and using its built-in mocks instead.

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

2 participants