gulp-babel

Babel throws a type error when exporting aggregates

不羁岁月 提交于 2020-05-13 06:41:15
问题 When running my gulp task, I get the following error: SyntaxError in plugin "gulp-babel" Message: /Users/******/Repos/******/src/scripts/config/index.js: Unexpected export specifier type > 1 | export * as constants from './constants'; ^^^^^^^^^^^^^^ I'm not sure why this is as I am running the required plugins to allow ES6 imports/exports, or so I thought... .babelrc { "presets": [ "@babel/preset-env", "@babel/preset-react" ], "plugins": [ "add-module-exports", "@babel/plugin-transform

How transpiling nodejs Gulp-Task with gulp-babel and ignore “import”?

冷暖自知 提交于 2019-12-11 16:05:38
问题 The goal is, transpiling ES6 scripts into ES5 and make them browser readable. This works most with my node.js gulp task, but some of the script use "import" like import EstaticoModule from '../../assets/js/helpers/module'; I would like to skip this "import" and more over delete this row from result. Is there a param in "gulp-babel" to achieve this or has one another idea to make this in a better way? Here is my gulp task: 'use strict'; /** * @function `gulp js:lint1` * @desc Lint JavaScript

Using Gulp-babel and getting “Argument name clash in strict mode”

我是研究僧i 提交于 2019-12-10 18:40:00
问题 I'm trying to use gulp-babel so I can start writing some ES6 / ES2015 code inside of my ES5 app. var gulp = require('gulp'), gutil = require('gulp-util'), gulpif = require('gulp-if'), uglify = require('gulp-uglify'), concat = require('gulp-concat'), sass = require('gulp-ruby-sass'), streamqueue = require('streamqueue'), sourcemaps = require('gulp-sourcemaps'), templateCache = require('gulp-angular-templatecache'), htmlReplace = require('gulp-html-replace'), runSequence = require('run-sequence

ES6 import module with Gulp

ぃ、小莉子 提交于 2019-12-08 15:41:25
问题 I am trying to import my ES6 module into a file and running Gulp to concat and minify the file. I'm running into a ReferenceError: require is not defined at all.js(transpiled) line no 3 . I have transpiled the code using gulp-babel. My js files are: cart.js: class Cart{ constructor(){ this.cart = []; this.items = items = [{ id: 1, name: 'Dove Soap', price: 39.99 },{ id: 2, name: 'Axe Deo', price: 99.99 }]; } getItems(){ return this.items; } } export {Cart}; app.js: import {Cart} from 'cart.js

Converting es6 script to JS using gulp

久未见 提交于 2019-12-08 13:46:22
问题 I am trying to convert the ES6 code to simple JS, using babel in gulp. Running the below code I am getting [Error in Plugin "gulp-babel"] with Message: [Plugin/Preset files are not allowed to export objects, only functions.] var gulp = require('gulp'); var babel = require('gulp-babel'); gulp.task('scripts',function(){ return gulp.src(['src/scripts/app.js']) .pipe(babel({presets:['es2015']})) .pipe(gulp.dest('build/scripts/')) }); src/scripts/app.js const hello = (name) => { return `hello $