cramforce/splittable

Seems to assume you have a local version of Babel

Closed this issue · 4 comments

> node -v
v6.3.1
> npm install -g splittable
> splittable index.js

Compilation failed:  Couldn't find preset "es2015" relative to directory "/Users/matthew/Projects/splittable-example" while parsing file: /Users/matthew/Projects/splittable-example/index.js

Installing babel-preset-es2015 into the local folder fixes it, but from the readme I don't think this is the intended way to use it. Shouldn't it be reading from splittable's own dependency?

Should be fixed by #2. Republished to NPM

Are you sure that will fix it? I think that will just replace what it complains about. The bug I was experiencing is that it assumes that the preset (soon to be plugin) is installed locally.

I think this is because Babel assumes to be used by the end user and not another tool. Maybe @hzoo could confirm.

I've had this problem in the past and I think you'll want to use require.resolve("babel-plugin-transform-es2015-modules-commonjs") so that it uses your copy of the plugin.

I'll try and send a PR if it works.

require.resolve() does indeed fix it, I'll submit a PR.