markdalgleish / redial

Universal data fetching and route lifecycle management for React etc.
1.1k stars 42 forks source link

Enable bundling with Babel 6 #29

Closed alexmchardy closed 8 years ago

alexmchardy commented 8 years ago

I'm attempting to use redial in my project where I have Webpack bundling it with babel/babel-loader version 6.x. Unfortunately, babel-loader is loading up and choking on redial's .babelrc file, which has a Babel 5 option (optional: es7.decorators) that was removed in Babel 6:

ERROR in ./~/redial/lib/index.js
Module build failed: ReferenceError: [BABEL] /myapp/node_modules/redial/lib/index.js: Using removed Babel 5 option: /myapp/node_modules/redial/.babelrc.optional - Put the specific transforms you want in the `plugins` option
...
at Object.module.exports (/myapp/node_modules/babel-loader/index.js:88:12)

Since redial builds on npm prepublish and doesn't include src in its package, it seems like its .babelrc shouldn't be there in the package anyway. I verified that removing it from the published package fixes this issue.

You might consider upgrading redial to Babel 6 as well.

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling 06a5970359db2900984f41db6591257dd163b3b6 on alexmchardy:unpackage-babelrc into \ on markdalgleish:master**.

markdalgleish commented 8 years ago

Thanks! Just published as v0.4.2.

By the way, you probably shouldn't be running external library code through Babel, regardless of whether it works or not. You should exclude node_modules from your JS loader config.

alexmchardy commented 8 years ago

Awesome, thanks!