Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unexpected token: name (IonRangeSliderModule) #3

Closed
Al-eXO opened this issue May 15, 2017 · 9 comments
Closed

Unexpected token: name (IonRangeSliderModule) #3

Al-eXO opened this issue May 15, 2017 · 9 comments

Comments

@Al-eXO
Copy link

Al-eXO commented May 15, 2017

angular/cli 1.0.0-rc.1

npm i --save ng2-ion-range-slider

When run "ng build --prod" i get this error
ERROR in vendor.366456fc5ebb4b269eba.bundle.js from UglifyJs
Unexpected token: name (IonRangeSliderModule) [vendor.366456fc5ebb4b269eba.bundle.js:67797,4]

How fix this?

@lesliesu
Copy link

lesliesu commented May 15, 2017

"ng build" without --prod flag worked, and with it, I have got the same issue. It seems like some errors happened while UglifyJs doing its job on this library.

@dinhkk
Copy link

dinhkk commented May 20, 2017

I am facing the same issue without solution.

@souravmondal93
Copy link

Can you guys try to change the tsconfig.json file with the following option.

{
  "compilerOptions": {
    .....
    "target": "es5",
    .....
  }
}

Are you guys still facing the same problem after this change?
@Al-eXO @lesliesu @dinhkk

@Al-eXO
Copy link
Author

Al-eXO commented May 22, 2017

yes, i'm trying. no result.

@sheetaldshivdas
Copy link

ERROR in vendor.366456fc5ebb4b269eba.bundle.js from UglifyJs
Unexpected token: name (IonRangeSliderModule) --> Got this same error.

@guidux
Copy link

guidux commented May 26, 2017

As far as I know ng build --prod runs uglify (stable release) which currently doesn't support es6. If you take a look to this file "my_project/node_modules/ng2-ion-range-slider/lib/ion-range-slider.module.js" it uses let in line 11 which is new stuff from es6. To conclude, I am trying to build locally using es5 instead, but so far I haven't done it yet because this command npm run ngc-build returns error I couldn't figure it out. Hope to add more info about this. If anyone can bring anything else about this would be great.

@guidux
Copy link

guidux commented May 27, 2017

Finally I manage to figure it out and solve it. I changed tsconfig.js and look as below.

"compilerOptions": {
      "target": "es5",
    "declaration": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "lib": [ "es2015", "dom" ],
    "outDir": "lib",
    "rootDir": "src"
  },

I had to change package.json to look as:

"devDependencies": {
    "@angular/common": "2.4.4",
    "@angular/compiler": "2.4.4",
    "@angular/compiler-cli": "2.4.4",
    "@angular/core": "2.4.4",
    "@types/core-js": "^0.9.41",
    "typescript": "2.0.9"
  },
  "dependencies": {
    "@angular/core": "2.4.4",
    "@types/jquery": "^2.0.40",
    "ion-rangeslider": "2.1.6",
    "rxjs": "^5.4.0",
    "zone.js": "^0.7.8",
    "@types/node": "~6.0.60"
  }

I will fork the project and commit my changes soon. Hope this help anyone.

umens pushed a commit to umens/ng2-ion-range-slider that referenced this issue Jun 5, 2017
@umens
Copy link
Contributor

umens commented Jun 5, 2017

hey @guidux, I just submit a PR based on your comments since you didn't provide your fork yet. Is that what you were thinking about ?
I don't have the UglifyJs error anymore.

Can you check the PR @PhilippStein ?

@PhilippStein
Copy link
Owner

@umens I merged your pull request #4 and released new version v1.0.3
@souravmondal93 @umens, @guidux Thanks for help fixing that.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants