Unexpected token @ on babylon index.js
francisrod01 opened this issue · comments
I have a problem to minify vendor scripts to production type.
I think that error is caused of angular-route
and animate-css
.
References to issues:
terinjokes/gulp-uglify#297
babel/babylon#546
I think that this code needs a filter to bower scripts / styles.
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)
I have a solution to solve this issue, but II need to followed this steps:
-
Mapping some files that not are in dirbase of your library. (with
override
param into thebower.json
file). See more details here: Bower - Override options -
Add a filter of JS to
bowerFiles
not to try parse css files also. Reference:
Using the Gulp pipeline to use Bootstrap with jQuery and minify the resulting JavaScript
That's it, however styles doesn't build. A issue was created here #14