laravel-mix: Error on npm run production on shapecss

I am have error on npm run production, and its killing me 😦

/js/shapecss.js from UglifyJs Unexpected token: name (Accordion) [./~/shapecss/resources/assets/js/component/Accordion.js:1,0][/js/shapecss.js:19054,6]

I am using shapecss developed in laravel mix.

here is code is look like,

'use strict';

import {Accordion} from "./component/Accordion";
import {Modal} from "./component/Modal";
import {getTab} from "./component/Tab";
import {Nav} from "./component/Nav";
import {Circle} from "./component/shapes/Circle";
import {Parallelogram} from "./component/shapes/Parallelogram";
import {Rectangle} from "./component/shapes/Rectangle";
import {Square} from "./component/shapes/Square";


window.onload = function () {
  new Accordion();
  new Modal();
  getTab();
  new Nav();
  new Circle();
  new Parallelogram();
  new Rectangle();
  new Square();
}

Accordion class is look like,

export class Accordion{
        constructor(){
            this.accordionDivs = document.getElementsByClassName('accordion');
            if(this.accordionDivs)
            this.processAccordions();
        }
processAccordions() {
...
}

for detail please check,

Accordion class

and entry file,

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

This is not working be ause the es6 version of uglify has not landed yet, you will need to transpiled the js used to es5 before uglify can support it

Mix’s webpack config file doesn’t run Babel on any files in your node_modules directory, so that’s likely the issue.

No im suggesting that you use a tool like babel to transpiled this code to es5 so uglify can minify it. ORRR use a tool like babili (babel-minify) to minify your code.