roberto tomás
roberto tomás

Reputation: 4687

gulp babel 6.14.0 not working

It sure feels like I am following all the advise for using gulp with babel ^6.

I have done:

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

Babel

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"]
}

npm

Then, to ensure its all going to work, I delete ./node_modulesand runnpm 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

Answers (1)

loganfsmyth
loganfsmyth

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

Related Questions