2
votes

Following are the steps I do to generate bundle.min.js:

1) firstly, tscompile with es2015 for my target and module.

2) npm run rollup (i.e., rollup -f iife -c -o dist/prod/client/app/bundle.es2015.js).

3) npm run es5 (i.e., tsc --target es5 --allowJs dist/prod/client/app/bundle.es2015.js --out dist/prod/client/app/bundle.js).

4) npm run minify (i.e., uglifyjs dist/prod/client/app/bundle.js --screw-ie8 --compress --mangle --output dist/prod/client/app/bundle.min.js ).

Below is the error after minification:

Error: (SystemJS) Unexpected strict mode reserved word SyntaxError: Unexpected strict mode reserved word at ZoneDelegate.invoke (https://unpkg.com/[email protected]?main=browser:203:28) at Zone.run (https://unpkg.com/[email protected]?main=browser:96:43) at https://unpkg.com/[email protected]?main=browser:462:57 at ZoneDelegate.invokeTask (https://unpkg.com/[email protected]?main=browser:236:37) at Zone.runTask (https://unpkg.com/[email protected]?main=browser:136:47) at drainMicroTaskQueue (https://unpkg.com/[email protected]?main=browser:368:35) Evaluating http://localhost:9000/app/bundle.min.js Error loading http://localhost:9000/app/bundle.min.js

enter image description here

I'm getting above error while I'm creating the production build for my angular2 application using Rollup.js for Tree Shaking but I'm not sure what im doing wrong earlier it was working fine and still its working on development environment but not in production kindly help me I've also tried to run my app without minification i.e., 4th step and it shows below error:

Error: TypeError: __extends is not a function ?

2

2 Answers

0
votes

I've seen this mentioned a few times, as far as I know the fix is to upgrade your node stuff (what version of Node/npm are you running).

If you've tried that and it's the same problem, then I'd go back to the original error, which is that somewhere you are using a reserved keyword (like yield or some such) as a var name, and you're not supposed to be doing that.

0
votes