Skip to content

Not working with Babel 6 #228

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

Closed
voodooattack opened this issue Nov 12, 2015 · 3 comments
Closed

Not working with Babel 6 #228

voodooattack opened this issue Nov 12, 2015 · 3 comments

Comments

@voodooattack
Copy link

I get the following error when I try to require('graphql') in a project that uses babel-core 6.x:

    /home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/logger.js:43
        throw new Constructor(this._buildMessage(msg));
        ^

    ReferenceError: [BABEL] /home/voodooattack/dev/feenda/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMerged.js: Unknown option: /home/voodooattack/dev/feenda/node_modules/graphql/package.json.optional
        at Logger.error (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/logger.js:43:11)
        at OptionManager.mergeOptions (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/options/option-manager.js:250:18)
        at OptionManager.addConfig (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/options/option-manager.js:209:10)
        at OptionManager.findConfigs (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/options/option-manager.js:358:30)
        at OptionManager.init (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:12)
        at File.initOptions (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/index.js:191:75)
        at new File (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/file/index.js:122:22)
        at Pipeline.transform (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
        at Object.transformFileSync (/home/voodooattack/dev/feenda/node_modules/babel-core/lib/api/node.js:118:10)
        at compile (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:103:20)
        at loader (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:128:14)
        at Object.require.extensions.(anonymous function) [as .js] (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:138:7)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:311:12)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)
        at Object.<anonymous> (/home/voodooattack/dev/feenda/node_modules/graphql/validation/specifiedRules.js:102:42)
        at Module._compile (module.js:425:26)
        at Module._extensions..js (module.js:432:10)
        at Object.require.extensions.(anonymous function) [as .js] (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:136:7)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:311:12)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)
        at Object.<anonymous> (/home/voodooattack/dev/feenda/node_modules/graphql/validation/validate.js:43:23)
        at Module._compile (module.js:425:26)
        at Module._extensions..js (module.js:432:10)
        at Object.require.extensions.(anonymous function) [as .js] (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:136:7)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:311:12)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)
        at Object.<anonymous> (/home/voodooattack/dev/feenda/node_modules/graphql/graphql.js:55:27)
        at Module._compile (module.js:425:26)
        at Module._extensions..js (module.js:432:10)
        at Object.require.extensions.(anonymous function) [as .js] (/home/voodooattack/dev/feenda/node_modules/babel-register/lib/node.js:136:7)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:311:12)
        at Module.require (module.js:366:17)
        at require (module.js:385:17)
        at Object.<anonymous> (/home/voodooattack/dev/feenda/node_modules/graphql/index.js:17:16)
@voodooattack
Copy link
Author

It appears to work when I comment the following:

require('babel-core/register')({
//  only: /app/,
//  ignore: /^(node_modules|bower_components)$/,
  presets: ['es2015', 'stage-1', 'react']
});

@dizlexik
Copy link
Contributor

The real problem is the presence of babel.optional in the package.json. I'm not sure what the recommended approach is for dealing with this but for now I've removed the entire babel block from graphql's package.json and it's working for me.

@leebyron
Copy link
Contributor

Thanks for the report. Babel 6 changed how it interprets the package.json files found within node modules breaking how graphql and some of our other open source packages work. We plan to upgrade to Babel 6 soon which should fix the issue, in the meantime feel free to apply that hack which seems fine to me.

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

3 participants