babel/babylon

Unexpected token @ on babylon index.js

francisrod01 opened this issue · 3 comments

Input Code

I have a problem to minify vendor scripts. I think that error is caused by angular-route syntax

Reference:

pipes.builtVendorScriptsProd = function () {
  return gulp.src(bowerFiles())
    .pipe(pipes.ordererVendorScripts())
    // .pipe(plugins.minify())
    .pipe(plugins.babel({compact: false, presets: ['es2015']}))
    .pipe(plugins.concat('vendor.min.js'))
    // .pipe(plugins.uglify({compress: true}).on('error', pipes.showErrors))
    .pipe(gulp.dest(paths.distScriptsProd))
}

I comment the line with uglify that also the same problem that.
See output in below:

internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^
SyntaxError: /home/paneladm/projects/website/bower_components/animate.css/animate.css: Unexpected token (1:0)
> 1 | @charset "UTF-8";
    | ^
  2 | 
  3 | /*!
  4 |  * animate.css -http://daneden.me/animate
    at Parser.pp$5.raise (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:4452:13)
    at Parser.pp.unexpected (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$1.parseDecorator (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1939:10)
    at Parser.pp$1.parseDecorators (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1924:26)
    at Parser.pp$1.parseStatement (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1818:10)
    at Parser.pp$1.parseBlockBody (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:2268:21)
    at Parser.pp$1.parseTopLevel (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1778:8)
    at Parser.parse (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:1673:17)
    at parse (/home/paneladm/projects/website/node_modules/babylon/lib/index.js:7180:37)
    at File.parse (/home/paneladm/projects/website/node_modules/babel-core/lib/transformation/file/index.js:517:15)

Babylon/Babel Configuration

$ npm ls babylon
website-business@0.0.1 /home/paneladm/projects/website
├─┬ babel-preset-es2015@6.24.1
│ └─┬ babel-plugin-transform-es2015-block-scoping@6.24.1
│   ├─┬ babel-template@6.24.1
│   │ └── babylon@6.17.1  deduped
│   └─┬ babel-traverse@6.24.1
│     └── babylon@6.17.1  deduped
└─┬ gulp-babel@6.1.2
  └─┬ babel-core@6.24.1
    └── babylon@6.17.1 
software version
Babylon babylon@6.17.1 deduped
node node/7.10.0 (I use n)
npm 4.6.1
Operating System Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux
hzoo commented

Hey @francisrod01! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

hzoo commented

It looks like it's trying to parse css? bower_components/animate.css/animate.css Babylon only parses JS to it would error so we'll need to figure out why it's trying to parse .css or how to filter that.

This shouldn't be a Babel/babylon issue?

@hzoo yeah, I think that this code needs a filter to bower scripts.
Thanks for watching this detail!