-
Notifications
You must be signed in to change notification settings - Fork 479
module not found error in @angular/platform-server when building fresh Angular 14 project #2686
Description
Which @angular/* package(s) are the source of the bug?
platform-server
Is this a regression?
No
Description
I've created a new angular project and added only the @nguniversal/express-engine because I want to create a SSR project.
When I try to build the project I get the following errors:
ng build
√ Browser application bundle generation complete.
Warning: PATH_TO_PROJECT\node_modules@angular\platform-server\fesm2020\platform-server.mjs depends on 'domino'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
./node_modules/@angular/platform-server/fesm2020/platform-server.mjs:18:0-27 - Error: Module not found: Error: Can't resolve 'url' in 'PATH_TO_PROJECT\node_modules@angular\platform-server\fesm2020'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
./node_modules/@angular/platform-server/fesm2020/platform-server.mjs:18:0-27 - Error: Module not found: Error: Can't resolve 'url' in 'PATH_TO_PROJECT\node_modules\@angular\platform-server\fesm2020'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 14.0.0
Node: 16.15.1
Package Manager: npm 8.11.0
OS: win32 x64
Angular: 14.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1400.0
@angular-devkit/build-angular 14.0.0
@angular-devkit/core 14.0.0
@angular-devkit/schematics 14.0.0
@nguniversal/builders 14.0.0
@nguniversal/express-engine 14.0.0
@schematics/angular 14.0.0
rxjs 7.5.5
typescript 4.7.3
Anything else?
No response