Comments (11)
I'm going to transfer this issue to our CLI repo, but I suspect you may end up needing to file it as an issue on NX, unless you can reproduce the problem in the CLI itself.
from angular-cli.
Here's a bare setup where bootstrapApplication
is within a promise then
callback: StackBlitz. Both ng serve
and ng serve --configuration production
don't show this issue. Again, without a reproduction this won't be actionable from our end.
from angular-cli.
Concretely, this is not an Nx issue so you can close the issue over there. That said, the esbuild conversion schematic is unlikely to be updated to account for this, as 1) it wouldn't be aware of those TS options in angularCompilerOptions
(they really do not belong there!) and 2) there's plenty potential reasons why esbuild may behave differently to Webpack; the CLI will never be able to account for all of it.
from angular-cli.
Without a reproduction, it's impossible to tell where this import is coming from
from angular-cli.
Well, repro steps for Nx are:
- nx generate convert-to-application-executor
- nx s
- 'success build'
- open localhost:4200
- 'given error'
Repro steps for manuall conversion from browser to browser-esbuild:
- In project.json edit line:
"builder": "@angular-devkit/build-angular:browser",
- into:
"builder": "@angular-devkit/build-angular:browser-esbuild",
- nx s
- 'success build'
- open localhost:4200
- 'given error'
from angular-cli.
I opened the issue in Nx repo: nrwl/nx#22712
from angular-cli.
For better overview, here's GIF of repro steps. Plus screen of what main.js link in console.log refers to (if it helps with something)
from angular-cli.
Here: I've cleared the company's code and keep only the wrapper of the app. It should throw the error when you open the app.
https://github.com/pr033r/angular-issue
from angular-cli.
I think that I found the solution. Maybe due to failed migration command (at least I'm expecting that those things will be fixed/migrated/rewrited) but the issues was in tsconfig.base.ts
file. When I copied it from newly created project, It started working and the error message is no longer there.
Here's the commit. Check for tsconfig.base.ts
from angular-cli.
Interesting. The tsconfig.base.ts
includes TypeScript options module
and target
in angularCompilerOptions
, which happens to somewhat work due to an implementation quirk. Those options should be included in compilerOptions
.
The crucial part that breaks things here is "module": "commonjs"
, and because it's present in angularCompilerOptions
it doesn't follow the regular config cascade: although it's defined in the root tsconfig, it overrides the derived values in inherited tsconfig
filesโAngular reads the configuration hierarchy in two phases: first resolving the angularCompilerOptions
hierarchy, then letting TypeScript load its config file with the angularCompilerOptions
on top.
The CLI doesn't really support CommonJS output anymore, which is ultimately the reason why this breaks. The CLI could perhaps detect this as a warning and ignore it in favor of es2022, just like it does when target
is set to an unsupported variant.
from angular-cli.
The project has been created like almost 3 years ago by different dev. I am managing this project last 1.5 year so I am surprised that any migration didn't pop up some warn/error at least ๐.
Actually, I was also wondering If I should create a new project from sratch and move all libs from old project to the new one. But it's too much work and effort. If there'd be some script to transfer all project confs files into latest schemas/formats it'd be perfect (and devs who are managing some older created projects would be calmer - that they're using updated and latest schemas/configs etc.)
Anyway, thanks for your time and effort guys. I appreciate it ๐
from angular-cli.
Related Issues (20)
- Asset referenced with CSS variables not found using application-builder HOT 6
- Tests using `web-test-runner` time out waiting for the browser to start
- Could not resolve "zone.js/node" HOT 6
- Support webpack-dev-server v5 HOT 1
- Routing not working in application under projects folder HOT 1
- Replace usages of '@nguniversal/' packages with '@angular/ssr'. ร Migration failed HOT 1
- headers for dev-server not working anymore after upgrade from angular 16 to 17 HOT 8
- @angular-devkit/build-angular depends on vulnerable version of tar HOT 1
- globalThis.ng gets replaced HOT 5
- Angular compilation initialization failed. [plugin angular-compiler] HOT 2
- Deprecated type attribute in `index.html`: `<style type="text/css">`
- Angular never searches for zone.js in the correct path HOT 6
- Amount of spaces after ng generate HOT 3
- [browser-esbuild] live-reload=false workflow is less convenient now
- Excessive modulepreload Links in Angular 18.0.0-next.4 Affecting Performance Metrics HOT 5
- Bug: esbuild builder 3rd party libs built not properly with browserify paths HOT 1
- Only reload on ng serve when change in code happen HOT 3
- Ability to generate hash on every build without changing file HOT 1
- sourcemap isn't working HOT 2
- support npm version 1- HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-cli.