Open Hai-San opened 5 years ago
@MartDSam hey bro ! 👍
here the best gulp-boilerplate https://github.com/jh3y/gulp-boilerplate
best boilerplater ever i add babel7 to it: gulp-bolilerplate.zip
Babel7, es6withGulp4 , cssComb, Scss, Pug, BrowserSync, Autoprefixer, RollUp, ...
its babel or gulp error not anime.js error
GL HF! :)
@riiccardo Thanks for listening.
This is all configuring in a wordpress repository. So I already have a GULP configuration very well aligned with my repository. It is very specific. Using a boilerplate now would be very complicated to make all the adjustments.
I do not say it would be a bug from anime.js, maybe I mispronounced. My gulp configuration works normally with any other js plugin or library. But only anime.js and tilt.js gave this problem.
The two have the same functions at the end of the code: ES: export default OLD: module.exports
The gulp along with Babel minify and make the necessary adjustments in a way that the browser does not understand.
Did you try using the anime.min.js
file instead?
If I put it directly without going through the gulp, it does not give any error on the console. But if I pass the .min by the gulp with or without babel it gives the following error:
Cannot set property 'anime' of undefined
In this line:
After babel:
"object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : n.anime = e();
before babel:
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : n.anime = e()
Thanks :)
Describe the bug When I try to minify the library using gulp + babel, the following errors occur in the browser:
1 - anime.js: module is not defined
2 - anime.es.js: exports is not defined
anime.es.js without the babel he can not even minify: GulpUglifyError: unable to minify JavaScript Caused by: SyntaxError: Unexpected token: keyword (default) File: \js\libraries\anime\anime.es.js Line: 1296 Col: 7
To Reproduce "@babel/core": "^7.2.2", "@babel/preset-env": "^7.2.3", "gulp": "^4.0.0", "gulp-babel": "^8.0.0", "gulp-uglify": "^3.0.1"
function default_libraries() { return gulp.src(defaultPaths.libraries.src) .pipe(changed(defaultPaths.libraries.dest)) .pipe(babel({ presets: ['@babel/env'], ignore: [ defaultPathLib + "anime/" // I already tested with and without. ] })) .pipe(uglify()) .pipe(ext_replace('.js', '.min.js')) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest(defaultPaths.libraries.dest)); }
I use the latest version of chrome.
I had the same problem with another library. But they created a version for babel that worked very well. This is the library: here
Thanks :)