You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Webpack Warning in system_js_ng_module_factory_loader.js #11580
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When compiling using webpack, in angular rc7 core libraries there are a couple of warnings.
Expected behavior
I guess no warnings... :-)
Reproduction of the problem
Install a bare project, the simplest you like using webpack with the Angular2 rc7 revision and you will get the warnings.
Please tell us about your environment:
All the last versions of Angular2 rc7, typings, ts and webpack related dependencies. All of them on the latest versions npm has.
Reacted by Jarred McGoldrick, Lars Rye Jeppesen, Leo Caseiro, d-ph, Charly Delay, Chris Nicola, Gábor Soós, returnlytom, Dmitry Demeshkin, Tereza and 50 more
you need to provide context to Angular's use of System.import
newwebpack.ContextReplacementPlugin(// The (\\|\/) piece accounts for path separators in *nix and Windows/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,root('./src'),// location of your src{}// a map of your routes ),
update:
the path changed to /angular(\\|\/)core/
update: #11580 (comment)
Reacted by Simon, Leo Caseiro, Rachel Yordán, Gábor Soós, Marcos Felipe Pimenta Rodrigues, Adam Wamai Egesa, Giulianno Sbrugnera, pavelnoroc, Nhan Doan, baidario and 14 more
module.exports={plugins: [newwebpack.ContextReplacementPlugin(// The (\\|\/) piece accounts for path separators in *nix and Windows/angular(\\|\/)core/,root('./src'),// location of your src{})]}functionroot(__path){returnpath.join(__dirname,__path);}
or
newwebpack.ContextReplacementPlugin(/angular(\\|\/)core/,path.resolve(__dirname,'src'),// path to your src{})
Reacted by Marcos Morales Rodrigo, Simon, Michael Chiche, Leo Caseiro, CyrilleGuimezanes, bykbtzr, Rachel Yordán, Gábor Soós, 姚远, Adam Wamai Egesa and 74 more
Reacted by 毒枭东, PatrickJS, Stefan Iseli and Augustus
Reacted by Shibiko, PatrickJS and Stefan Iseli
Reacted by Rytis Grincevičius, Gábor IMRE, Etienne Bondot, Rohit Dewaker, Jean-Louis GUENEGO , Shibiko, PatrickJS, alonrbar, ravshansbox, Khaled Sameer and 3 more
Fantastic! Yep, that was the missing piece. Thank you very much!
Just one last question, why before with the RC6 I didn't get those warning and with the RC7 I do?
What is the actual purpose of that plugin?
Thank you very much for your help! You're a legend!
This bug doesn't yet mention the actual warning (it's only in the OP's image), so you cannot find it by searching:
WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
45:15 Critical dependency: the request of a dependency is an expression
Reacted by Rachel Yordán, Ghet, Sam Bleckley, Gian Marco Gherardi, Grant Hutchins, Grundy, Daniel Betz, Marin Takanov, Claudiu Constantin, Sean Newell and 7 more
@jtsom Mind you, this is just a warning, not an error. However, like you, I was also getting that warning while at the same time getting some new errors in my karma tests (ng test). Like you, I have an app created with angular-cli. At first I thought the warning and the errors were related but undoing my recent changes disproved that theory. I had just recently added angular2-material and my unit tests were failing with errors like "template parse errors: md-whatever". I just had to update my unit tests (the beforeEach section in particular) and add all the referenced angular2-material providers and components used in each respective component class. I hope this helps you as well! The errors are definitely not very helpful and it took me longer than I care to admit to resolve this.
Hi I am unable to solve this warning as well as error.
WARNING in ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js
4982:15-36 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js
4994:15-102 Critical dependency: the request of a dependency is an expression
ERROR in /node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/view.d.ts (122,5): A computed property name in an interface must directly refer to a built-in symbol.
ERROR in /node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/container.d.ts (35,5): A computed property name in an interface must directly refer to a built-in symbol.
ERROR in 26/node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/container.d.ts (45,5): A computed property name in an interface must directly refer to a built-in symbol.
module.exports={plugins: [newwebpack.ContextReplacementPlugin(// The (\\|\/) piece accounts for path separators in *nix and Windows/angular(\\|\/)core/,root('./src'),// location of your src{})]}functionroot(__path){returnpath.join(__dirname,__path);}
or
newwebpack.ContextReplacementPlugin(/angular(\\|\/)core/,path.resolve(__dirname,'src'),// path to your src{})
I have tried to find the above webpack.config.js in my Angular 4 project, which was created using the CLI, but to no avail.
The only file that I can find and which comes close is webpack.js under --> node_modules@angular-devkit\build-angular\src\angular-cli-files\plugins\webpack.js and there is no code that resembles what is mentioned in above post, listed as a feasible solution to the error.
Console gave me the following result after having used the npm update command on my Angular project...
...which broke the app, essentially leading to this dead end.
I have tried to update manually the two first dependencies by running their respective npm install commands but this didn't result in any change of behavior. I still receive the same error and am stuck.
I would appreciate if someone could provide help and guidance to resolve this issue as I cannot move ahead with the project until I resolve this.
Thanks in advance.
EDIT: In case it matters, I tried creating a new Angular 4 project and there isn't any issue compiling the new app. So the question is simply, how to do a rollback or fix the above error report. I could move the syntax over but would prefer to learn how to fix the issue, should the problem arise again in the future, as well as to better understand the built itself.
In regards to my previous question, I found a workaround. I changed the nomination of the following line's variable in view.js from var fn = require(mod).__express to const fn = require(mod).__express and the rendering of pages now works again. Don't know if that is 'best practices' but nevertheless, everything functions again like before. If someone could give some input on whether or not that means anything in terms of future development/issues down the road, that'd be swell. Thanks.
CLI no longer uses SystemJS and I have not seen these warnings. Closing as I believe that this issue is out of date.
If this is still an issue please comment here with an reproduction on the latest Angular.
Activity
supermarcos commentedon Sep 14, 2016
Is this happening to someone else?
Thanks!
PatrickJS commentedon Sep 14, 2016
you need to provide context to Angular's use of System.import
update:
the path changed to
/angular(\\|\/)core/update:
#11580 (comment)
supermarcos commentedon Sep 14, 2016
Thanks for your prompt answer, @gdi2290 , sorry if I am asking something stupid, but... where should I do that? Webpack config maybe? Thanks again!
PatrickJS commentedon Sep 14, 2016
webpack.config.jsor
update:
#11580 (comment)
supermarcos commentedon Sep 14, 2016
Fantastic! Yep, that was the missing piece. Thank you very much!
Just one last question, why before with the RC6 I didn't get those warning and with the RC7 I do?
What is the actual purpose of that plugin?
Thank you very much for your help! You're a legend!
robwormald commentedon Sep 14, 2016
i'm going to reopen this, as we're tracking what to do about it.
Tragetaschen commentedon Sep 14, 2016
This bug doesn't yet mention the actual warning (it's only in the OP's image), so you cannot find it by searching:
WARNING in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
45:15 Critical dependency: the request of a dependency is an expression
jtsom commentedon Sep 14, 2016
Except this error, for me, is happening in an Angular-cli app, while running tests with ng test.. there is no webpack config file...
dcchristopher commentedon Sep 18, 2016
@jtsom Mind you, this is just a warning, not an error. However, like you, I was also getting that warning while at the same time getting some new errors in my karma tests (ng test). Like you, I have an app created with angular-cli. At first I thought the warning and the errors were related but undoing my recent changes disproved that theory. I had just recently added angular2-material and my unit tests were failing with errors like "template parse errors: md-whatever". I just had to update my unit tests (the beforeEach section in particular) and add all the referenced angular2-material providers and components used in each respective component class. I hope this helps you as well! The errors are definitely not very helpful and it took me longer than I care to admit to resolve this.
fix: Angular2 dependency warning
kahboom commentedon Sep 27, 2016
Many thanks @gdi2290, that resolved the error for me. 👍
73 remaining items
joebri commentedon Jun 28, 2018
Also interested in finding a fix. I thought updating esm5 to fesm5 in the webpack config might do the trick... but no joy.
build: remove workaround for angular issue #11580
build: remove workaround for angular issue #11580
kimamula commentedon Aug 20, 2018
I am not clear if I can safely ignore the warning messages.
My app looks working correctly with or without the
ContextReplacementPluginworkaround.sandeepKr54 commentedon Sep 27, 2018
Hi I am unable to solve this warning as well as error.
WARNING in ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js
4982:15-36 Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js
4994:15-102 Critical dependency: the request of a dependency is an expression
ERROR in /node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/view.d.ts (122,5): A computed property name in an interface must directly refer to a built-in symbol.
ERROR in /node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/container.d.ts (35,5): A computed property name in an interface must directly refer to a built-in symbol.
ERROR in 26/node_modules/amazing-time-picker/node_modules/@angular/core/src/render3/interfaces/container.d.ts (45,5): A computed property name in an interface must directly refer to a built-in symbol.
zoezydk commentedon Oct 30, 2018
I have tried to find the above webpack.config.js in my Angular 4 project, which was created using the CLI, but to no avail.
The only file that I can find and which comes close is webpack.js under --> node_modules@angular-devkit\build-angular\src\angular-cli-files\plugins\webpack.js and there is no code that resembles what is mentioned in above post, listed as a feasible solution to the error.
Console gave me the following result after having used the npm update command on my Angular project...
...which broke the app, essentially leading to this dead end.
I have tried to update manually the two first dependencies by running their respective npm install commands but this didn't result in any change of behavior. I still receive the same error and am stuck.
I would appreciate if someone could provide help and guidance to resolve this issue as I cannot move ahead with the project until I resolve this.
Thanks in advance.
EDIT: In case it matters, I tried creating a new Angular 4 project and there isn't any issue compiling the new app. So the question is simply, how to do a rollback or fix the above error report. I could move the syntax over but would prefer to learn how to fix the issue, should the problem arise again in the future, as well as to better understand the built itself.
zoezydk commentedon Oct 31, 2018
In regards to my previous question, I found a workaround. I changed the nomination of the following line's variable in view.js from
var fn = require(mod).__expresstoconst fn = require(mod).__expressand the rendering of pages now works again. Don't know if that is 'best practices' but nevertheless, everything functions again like before. If someone could give some input on whether or not that means anything in terms of future development/issues down the road, that'd be swell. Thanks.petebacondarwin commentedon Oct 26, 2020
CLI no longer uses SystemJS and I have not seen these warnings. Closing as I believe that this issue is out of date.
If this is still an issue please comment here with an reproduction on the latest Angular.
angular-automatic-lock-bot commentedon Nov 26, 2020
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.