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

TypeError: Cannot read property 'source' of null #102

Closed
langri-sha opened this issue Oct 18, 2019 · 4 comments
Closed

TypeError: Cannot read property 'source' of null #102

langri-sha opened this issue Oct 18, 2019 · 4 comments
Assignees

Comments

@langri-sha
Copy link
Contributor

I'd like to leave this here to save someone time in case they run into the following.

Internal error
TypeError: Cannot read property 'source' of null  
rewiremock/lib/babel/index.js:60:27

See Dynamic import from Babel 7.5.0 release. Need to ensure rewiremock/babel comes before the module transformer like so:

module.exports = {
  plugins: [
    '@babel/plugin-proposal-dynamic-import',
    'rewiremock/babel',
    '@babel/plugin-transform-modules-commonjs
  ]
}
@theKashey
Copy link
Owner

Anyway - it shall not lead to the error.

@theKashey
Copy link
Owner

Ok, so that's the common issue - I am trying to read data from imports after they were transformed. However, this check could be done during traverse...

@theKashey theKashey self-assigned this Oct 18, 2019
@theKashey
Copy link
Owner

Should be fixed in 3.13.8

@theKashey
Copy link
Owner

Rolling back. There is no way to play nicely together with @babel/plugin-transform-modules-commonjs except the right plugin order.

I am adding autodetection for this problem, but rolling the fix back.

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