Reputation: 4687
It sure feels like I am following all the advise for using gulp
with babel ^6
.
I have done:
npm i -g gulp-cli
I also have:npm i -D gulp-cli
npm i -D gulp
gulp -v
gives:
> gulp -v
[12:43:00] Failed to load external module babel-register
[12:43:00] Requiring external module babel-core/register
[12:43:00] CLI version 3.9.1
[12:43:00] Local version 3.9.1
My package.json has:
"devDependencies": {
"babel": "^6.5.2",
"babel-core": "^6.14.0",
"babel-preset-es2016": "^6.11.3",
and for good measure also:
"babel": {
"presets": [
"es2016"
]
},
My .babelrc has
{
"presets": ["es2016"]
}
Then, to ensure its all going to work, I delete ./node_modulesand run
npm install`.
My gulpfile.bable.js begins:
`use strict`
import gulp from 'gulp'
The output from gulp
begins:
here\>gulp
[12:42:51] Failed to load external module babel-register
[12:42:51] Requiring external module babel-core/register
here\gulpfile.babel.js:3
import gulp from 'gulp';
^^^^^^
SyntaxError: Unexpected reserved word
Upvotes: 0
Views: 517
Reputation: 161477
Your config "presets": ["es2016"]
only tells Babel to compile ES2016 -> ES2015. If you need to cover ES2015 -> ES5 (to convert ES2015 module syntax), you'd want "presets": ["es2015", "es2016"]
to cover both cases.
Upvotes: 1