I recently installed Angular 4 (RC2) and copied the files from the simple Quickstart example. But when I try to build the project with Webpack, I get errors stating that Rxjs can't be resolved:
WARNING in ~/@angular/core/@angular/core.es5.js
6857:19-40 Critical dependency: the request of a dependency is an expression
WARNING in ~/@angular/core/@angular/core.es5.js
6883:19-106 Critical dependency: the request of a dependency is an expression
ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/Subject' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 26:0-39
@ ./app/app.module.ts
@ ./main.ts
ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/observable/merge' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 23:0-46
@ ./app/app.module.ts
@ ./main.ts
ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/operator/share' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 24:0-44
@ ./app/app.module.ts
@ ./main.ts
ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/symbol/observable' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 25:0-54
@ ./app/app.module.ts
@ ./main.ts
ERROR in ~/@angular/core/@angular/core.es5.js
Module not found: Error: Can't resolve 'rxjs/Observable' in 'node_modules/@angular/core/@angular'
@ ~/@angular/core/@angular/core.es5.js 22:0-45
@ ./app/app.module.ts
@ ./main.ts
I've installed Rxjs 5.0.1, which I think is the version that Angular is expecting. I can't think of anything else to do.
The Angular build process uses webpack behind the scenes to transpile TypeScript to JavaScript, transform Sass files to CSS, and many other tasks. To understand the importance of this build tool, it helps to understand why it exists.
The application builder uses the webpack build tool, with default configuration options specified in the workspace configuration file ( angular.json ) or with a named alternative configuration.
Webpack 5 SupportYes you can use webpack 5 with Angular 11, but there are 2 things you need to keep in mind: This can be used if you are using yarn.
Webpack is a module bundler and task runner. Angular CLI is a command line interface that bundles some of the techniques mentioned above. Under the hood it uses Webpack. It is easy to create an application that works out of the box.
new ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
path.resolve(__dirname, '../src')
)
Works for me for webpack in webpack.common.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With