preboot/angularjs-webpack

Renaming "app" to something else, runtime error

klaszlo opened this issue · 3 comments

Hi!

Renaming MODULE_NAME in `client/app/app.js:19 to something else:

const MODULE_NAME = 'appb';

results in runtime error:

Error: [$injector:modulerr] Failed to instantiate module app due to:
[$injector:nomod] Module 'app' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.1/$injector/nomod?p0=app
minErr/<@http://localhost:8080/app.bundle.js line 91 > eval:68:12
module/<@http://localhost:8080/app.bundle.js line 91 > eval:2183:17
ensure@http://localhost:8080/app.bundle.js line 91 > eval:2107:38
module@http://localhost:8080/app.bundle.js line 91 > eval:2181:14
loadModules/<@http://localhost:8080/app.bundle.js line 91 > eval:4736:22
forEach@http://localhost:8080/app.bundle.js line 91 > eval:357:11
loadModules@http://localhost:8080/app.bundle.js line 91 > eval:4720:5
createInjector@http://localhost:8080/app.bundle.js line 91 > eval:4642:19
bootstrap/doBootstrap@http://localhost:8080/app.bundle.js line 91 > eval:1838:20
bootstrap@http://localhost:8080/app.bundle.js line 91 > eval:1859:12
angularInit@http://localhost:8080/app.bundle.js line 91 > eval:1744:5
@http://localhost:8080/app.bundle.js line 91 > eval:32977:5
trigger@http://localhost:8080/app.bundle.js line 91 > eval:3314:5

The two generated bundle.js file differs in MODULE_NAME variable only. However there are many app variable in the bundle.js, maybe this is why it worked in the first place.

What is the proper way to rename the default angular module name?

@klaszlo make sure you have the ng-app directive updated as well in the public/index.html

<html ng-app="app" lang="en">
phra commented

hi @klaszlo , if the solution provided by @mikeerickson resolves your problem, please close this ticket.
thank you.

It was really lame of me, so thank for the insight. I since updated my angular app to es6, so big thank you.

I'm closing this ticket. Sorry for keeping you busy with the obvious error on my side.