vigetlabs / blendid

A delicious blend of gulp tasks combined into a configurable asset pipeline and static site builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swiper 4 : Error with UglifyJS Unexpected token: name (w)

xavianaxw opened this issue · comments

I know this isn't a blendid issue but ...

I'm having issues compiling Swiper 4 for production where the error below will be thrown during compilation:

[12:05:58] gulp-notify: [Error running Gulp] Error:
app.js from UglifyJs
Unexpected token:
name (w) [app.js:54608,4]

There's an issue on it from the swiper repo regarding this at #2206 where it states it is using ES-Next so I am required to use babel-loader or import 'correct version' with import Swiper from 'swiper/dist/js/swiper.js';

My javascript config now currently looks like this:

javascripts: {
    entry: {
      // files paths are relative to
      // javascripts.dest in path-config.json
      app: ["./app.js"],
    },
    hot: {
      react: true,
    },
    babel: {
      presets: ["react-app"],
    },
  },

How should I go about to fix this?

babelLoader: {
    // "test" is derived from TASK_CONFIG.javascripts.extensions
    // "options" is derived from TASK_CONFIG.javascripts.babel
    loader: "babel-loader",
    exclude: /node_modules\/(?!(dom7|swiper)\/).*/,
},

in task-config.js fixed this for me