angular-seed icon indicating copy to clipboard operation
angular-seed copied to clipboard

Error after upgrading angular to rc.7

Open clogeceyhan opened this issue 10 years ago • 8 comments

I upgraded my project to RC7 and its throwing this error "ReferenceError: require is not defined"

at eval (http://localhost:5556/node_modules/traceur/src/node/api.js:22:12) Evaluating http://localhost:5556/node_modules/traceur/src/node/api.js Error loading http://localhost:5556/node_modules/traceur/src/node/api.js Error loading http://localhost:5556/node_modules/@angular/router/index.js as "@angular/router" from http://localhost:5556/app/app.module.js "Report this error at https://github.com/mgechev/angular2-seed/issues"

Any help would be appreciated.

Thanks.. Emrah

clogeceyhan avatar Sep 14 '16 18:09 clogeceyhan

Most likely you've upgraded from RC.5? The Angular bundles are distributed as ESM so that's why SystemJS tries to load traceur. If you create a clean clone of the repo everything should work. For support requests you can try gitter.

mgechev avatar Sep 14 '16 19:09 mgechev

Facing the same issue, do you any solution for this?

galvanu avatar Sep 21 '16 13:09 galvanu

I had to create a clean clone of the repo to make it work.

clogeceyhan avatar Sep 21 '16 14:09 clogeceyhan

@mgechev It feels bad to have to go into a clean clone to address this issue. Can you provide any additional information that might help in directly addressing the issue?

KyleCartmell avatar Oct 03 '16 20:10 KyleCartmell

Here's some additional information that I posted earlier today https://github.com/mgechev/angular2-seed/issues/1416#issuecomment-251171227. Most likely the problem that you're experiencing is related to systemjs trying to load Angular ESM modules instead of the bundles. You'll need to modify the SystemJS config in order to map all the Angular package requests to the bundles.

mgechev avatar Oct 03 '16 21:10 mgechev

@mgechev Is it normal to make such accommodations or have I gone astray? I moved my code into a fresh clone and saw the same result. I'm pulling my project apart systematically to find the root cause, but I wonder if you can point to an example of angular package requests being mapped to bundles? I'm motivated to stay out of the SystemJS configuration business as much as possible because I've found myself spending a lot of time in their issue tracker and puzzling over arcane error messages. Thank you for the tips!

KyleCartmell avatar Oct 03 '16 22:10 KyleCartmell

Would you share an export of your network tab in chrome devtools? If you request any files which are not transpiled to ES5 system will try to load traceur.

mgechev avatar Oct 03 '16 23:10 mgechev

If you request any files which are not transpiled to ES5 system will try to load traceur.

This was the tip that I needed to be successful. Thank you, Minko!

I have a depencency (ng2-sweetalert2) that is causing this issue. I'll either address it with them or find an alternative to being SweetAlert2 into ng2.

KyleCartmell avatar Oct 04 '16 15:10 KyleCartmell