-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Cannot read property 'call' of undefined #456
Comments
+1 When we update to recent commits (with Beta 11) we are facing the same issue as mentioned by @ryneflood We tried this
Tried to debug the error and found Webpack moduleId (170 in our case) not found and modules[moduleId] returning undefined. Tried developer tool's Error call stack : it is showing error in the first line of Any suggestions on debugging this issue would be great. |
OK so after a LOT of digging/playing around it seems like my issue is related to require()'ing css styles in components. I'm currently using PostCSS as outlined here: https://github.com/AngularClass/angular2-webpack-starter/wiki/How-to-include-PostCSS , but it also affects using SASS as suggested here: https://github.com/AngularClass/angular2-webpack-starter/wiki/How-to-include-SCSS-in-components If I remove all instances where I require() css in components the issue goes away Let me know if I can provide any more details to help get this fixed up! |
this code also needs to be disabled for it to work properly: (from main.browser.ts), once it's commented out and I unwrap the angular bootstrap function from the main() function it gets rid of the error
|
Same problem here thx |
@ryneflood what do you mean with "unwrap the angular bootstrap function from the main()" |
I tried some things but nothing worked for me, I commented anything from @gdi2290 experimental code then I include code from an old commit before main.browser.ts
but it is still the same error! some ideas? |
I am also having this issue, havent' been able to pin down which exact versions of webpack/angular which causes this. |
@penmark can you trying what @ryneflood wrote, I'm not sure what to do or I do the right thing but it doesn't solve the problem for me. |
+1 as above in Chrome, in firefox the error thrown is |
@zatomik can you test @ryneflood solution, if it works for you? |
@gdi2290 |
@mburger81 using main.ts from 3.0.0 works for me as well |
@penmark do you have no other problems like me? So I don't know how to resolves the problems |
@mburger81 no it doesnt work for me, neither does using the old main.ts, however have noticed that if I disable one of my nested routes the problem goes away. |
I'm experiencing the same issue. I think this is a general Webpack problem... |
I've narrowed my problem down to an import statement in one of my components, changed it from Seems to be working fine now. |
@mburger81 "unwrapping" the angular bootstrap from the main function just means:
becomes:
so the bootstrap is called immediately instead of waiting for something else to call main(); |
@ryneflood It's a little bit frustrating, I'm not able to get working my old stuff before I updated. I think all the problems came from webpack but I'm not sure! I have no idea what else I can try to do |
yeah this is still popping up for me. Anybody have any fixes? |
No solutions? |
I haven't found out the solution, but I've modified the webpack.config.js, removing vendor from CommonsChunkPlugin and now is working ok. So the possible workaround is change from webpack.config.js:
to
It's not the best solution, but meanwhile we can continue with our development. |
After downloading last master and merging with our app I had no problem with CommonsChunkPlugin, so I can not say if that had resolved me something before, but I don't think so. After merging, I had always the problems with beta.11 and ng2-bootstrap so I removed ng2-bootstrap every where from my app. After that my app works fine (with some layout and style bugs, beta11 problems?). But on creating my prodcution app I had still the same errors, see screenshot After that I tried to set the UglifyJsPlugin in debug mode in webpack.prod.js and this resolves me the problem. JUHU |
@edezacas removing vendor from CommonsChunkPlugin seems to be working for me, at least for now! |
Yeah, for production just disable code mangling of uglifyjs. Check issue on angular repository. |
beta 12 is out |
beta.12 doesn't seem to fix the problem for me... but removing |
on beta.12 i still not need to set CommonsChunkPlugin but mangling still doesn't work on production. |
I have similar problem. In my case change amount of code in html template (!!!!!) induce this error. In webpack.config.js i comment line ('vendor') and it works but I don't know for how long...:
|
this problem should be fixed in the latest release. the problem was due to the order that the HtmlPlugin was injecting the scripts |
From Wednesday I had suddenly again this problem! Today I migrate to the latest master of angular-webpack-starter upgrading zone.js to 0.6.8 as described in a angular2 issue and the problem is still there! It's frustrating a little bit :|
Then I commend |
I'm still having the problem with the latest version of the repo... |
@mastertinner tried to comment |
thanks, @mburger81. yes, i've tried that and it works. but it seems like more of a temporary solution to me. |
sorry the fix was removed when someone refactored the configs into a common one |
Ok I use your suggestion @gdi2290 - my project based on version of angular2-webpack-starter from near 1-3 march 2016. So I upgrade it manualy in this way: In webpack.config.js I uncomment vendors in:
And replace line:
And replace this:
By this:
Then I replace body of helpers.js file (in the same directory than webpack.config.js in my version - but in current wersion this and other files was moved to 'config' directory) to this But I change line (becouse in my version helpers.js file is in the same directory than webpack.config.js) : And it seems that it WORKS ! :) (do I do it in proper way?) |
@gdi2290 I confirm your last update fix this issue. |
Thanks, @gdi2290! That solved it. |
@kamil-kielczewski yup that's correct. awesome, I'm going to close this issue now that it's resolved |
I am still getting this error message today. Did it break again? |
My issue is specifically triggered by adding an additional component (i.e. src/app/whatever/whatever.component.ts) and then adding a 'styleUrls' attribute. Take out the styleUrls attribute and everything functions as normal. |
I just encountered this for the first time also on my prod build. If I do as @edezacas suggests and remove 'vendor' in weback.common.js, it works:
but I have no idea what the repercussions of removing vendor from that line are |
|
may be give us more details? (e.g. version of a2ws...) |
i am getting the same error. my webpack.config.js seems like this new CommonsChunkPlugin({
"name": "inline",
"minChunks": null
}),
new CommonsChunkPlugin({
"name": "vendor",
"minChunks": (module) => module.resource && module.resource.startsWith(nodeModules),
"chunks": [
"main"
]
}), pls help me where i need to make changes |
new webpack.optimize.CommonsChunkPlugin({
names: ['polyfills', 'vendor'], //<- pay attention to the order.
chunks: ['app'],
minChunks: module => /node_modules/.test(module.resource)
}), |
for me, it was fixed after clearing the browser cache |
Removing vendor from commonchunckplugin fixed the issue for me.:) thanks guys! |
yes also working for me @deepika-Gopala |
updating to node 9.2.0 fixed the issue for me |
i have been fired beacause of this problem.. |
You're the hero saving my life time ! |
[x ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
loading app fails intermittently with error: Uncaught TypeError: Cannot read property 'call' of undefined
started a week or so ago when I upgraded from around the beta.8 versions. In the mean time I've tried starting from a fresh copy of the starter, it'll work fine for a while but eventually it'll fail on that error. Sometimes it'll fail after just adding a new
eventually the error is on this line:
modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
it appears intermittently and seems to be random, it'll work one minute, and then fail the next. Making a couple changes (to nothing in particular) and restarting the dev server sometimes fixes it. And other times the app will be working fine but simply restarting the dev server will produce the error.
the same code also works fine when in a JSPM based build
Node: v5.9.0
NPM: 3.7.3
Using the latest code from repo as of March 22/2016
happens in multiple browsers (Firefox, Chrome, Opera)
polyfills.bundle.js:575 Uncaught TypeError: Cannot read property 'call' of undefined__webpack_require__ @ polyfills.bundle.js:575fn @ polyfills.bundle.js:99(anonymous function) @ main.browser.ts:5(anonymous function) @ main.bundle.js:734__webpack_require__ @ polyfills.bundle.js:575fn @ polyfills.bundle.js:99(anonymous function) @ multi_main:3(anonymous function) @ main.bundle.js:5__webpack_require__ @ polyfills.bundle.js:575webpackJsonpCallback @ polyfills.bundle.js:22(anonymous function) @ main.bundle.js:1
The text was updated successfully, but these errors were encountered: