ES6 import module with Gulp
问题 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