danielgtaylor / danielgtaylor/nesh
Cryptic error when loading a module with babel
- Dominant language
- CoffeeScript
- Stars
- 284
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
```
$ cat ./src/storage.js
export const sqrt = Math.sqrt;
export function square(x) {
return x * x;
}
export function diag(x, y) {
return sqrt(square(x) + square(y));
}
```
OK this is a pretty basic object. I'll try to import it:
```
~/projects/StarsApp @ Magni (jcollum)
$ nesh -b
Babel 5.8.38 on Node v7.8.0
Type .help for more information
babel> import './src/storage';
TypeError: Cannot read property 'error' of undefined
at OptionManager.mergeOptions (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
at OptionManager.addConfig (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
at OptionManager.findConfigs (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
at OptionManager.init (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
at compile (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/api/register/node.js:117:22)
at normalLoader (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/api/register/node.js:199:14)
at Object.require.extensions.(anonymous function) [as .js] (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
```
Key line:
`TypeError: Cannot read property 'error' of undefined
at OptionManager.mergeOptions (/Users/jcollum/.nvm/versions/node/v7.8.0/lib/node_modules/nesh/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28) `
I'm not sure what I'm doing wrong. The error isn't much help.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the `nesh -b` session and import of `./src/storage`, then trace the failure from Babel's `OptionManager.mergeOptions` in `babel-core/lib/transformation/file/options/option-manager.js`. Determine why the error becomes an undefined-property TypeError and make the reported failure actionable; done means the import no longer emits this cryptic error or reports a useful cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100