Comments (10)
You're probably not using ssr in the application: you don't have "ssr" entry in your angular.json.
That's an issue as the builder has to handle this use case, I will send a fix soon.
Thanks for reporting the problem.
from dotenv-run.
It should not, hopefully :)
The new esbuild based build system does not officially support esbuild plugins yet (which ngx-env is using), hence the warning from the angular builder package. That is why the ngx-env package is still in alpha.
If a future version of Angular makes the plugin system stable and you update your angular app, the warning would disappear.
Feel free to use the stable "future legacy" webpack builder as described here: #61 (comment)
from dotenv-run.
Thanks, I will keep using this package. I actually came across this builder from the custom-webpack builder because I wanted to use the faster esbuild / vite speeds that the new Angular versions allow for
from dotenv-run.
Hi, is NGX_ENV
env variable set? If not, try NGX_ENV=production npm run build
Could you share the logs from ngx-env/builder?
from dotenv-run.
Hi, no the NGX_ENV variable was not set. Is it a requirement ?
These are the relevant logs from when I run ng build
ng build
⠋ Building...---------------------------------
- Verbose: true
- Prefix: NG_APP
- Root directory: .
- Working directory: /Users/princegupta/mykaarma/mykaarma-js-starter-template
- Environment files:
✔ /Users/princegupta/mykaarma/mykaarma-js-starter-template/.env
- Injected keys:
✔ NG_APP_ENV => undefined
✔ NG_APP_HOSTNAME
✔ NG_APP_ROLLOUT_STAGE
✔ NG_APP_VERSION
---------------------------------
... application build logs
Application bundle generation complete. [7.647 seconds]
---------------------------------
- Verbose: true
- Prefix: NG_APP
- Root directory: .
- Working directory: /Users/princegupta/mykaarma/mykaarma-js-starter-template
- Environment files:
✔ /Users/princegupta/mykaarma/mykaarma-js-starter-template/.env
- Injected keys:
✔ NG_APP_ENV => undefined
✔ NG_APP_HOSTNAME
✔ NG_APP_ROLLOUT_STAGE
✔ NG_APP_VERSION
---------------------------------
✖ NGX_ENV: Cannot read index.html in dist folder
✖ Error: ENOENT: no such file or directory, open '/Users/princegupta/mykaarma/mykaarma-js-starter-template/dist/demo-app/server/index.server.html'
from dotenv-run.
If you're using the NGX_ENV environment variable inside your code then I guess it should be defined. Are you using it?
Just to be sure, when you set it, do you still have the error?
from dotenv-run.
I am not using NGX_ENV anywhere. The error remains the same even when I set the NGX_ENV variable. These are the logs
princegupta@princegupta mykaarma-js-starter-template % NGX_ENV=production npm run build
> [email protected] build
> ng build
⠋ Building...---------------------------------
- Verbose: true
- Prefix: NG_APP
- Root directory: .
- Working directory: /Users/princegupta/mykaarma/mykaarma-js-starter-template
- Environment files:
✔ /Users/princegupta/mykaarma/mykaarma-js-starter-template/.env
- Injected keys:
✔ NG_APP_ENV => undefined
✔ NG_APP_HOSTNAME
✔ NG_APP_ROLLOUT_STAGE
✔ NG_APP_VERSION
---------------------------------
⠇ Building...▲ [WARNING] bundle initial exceeded maximum budget. Budget 500.00 kB was not met by 197.13 kB with a total of 697.13 kB.
⠧ Building...▲ [WARNING] Module 'shimmer' used by 'node_modules/@opentelemetry/instrumentation/build/esm/instrumentation.js' is not ESM
CommonJS or AMD dependencies can cause optimization bailouts.
For more information see: https://angular.io/guide/build#configuring-commonjs-dependencies
Initial Chunk Files | Names | Raw Size | Estimated Transfer Size
main-DRJPZ65I.js | main | 359.91 kB | 90.08 kB
styles-FQ3MBTND.css | styles | 303.94 kB | 26.18 kB
polyfills-GUX7YTFP.js | polyfills | 33.29 kB | 10.76 kB
| Initial Total | 697.13 kB | 127.02 kB
Application bundle generation complete. [6.059 seconds]
---------------------------------
- Verbose: true
- Prefix: NG_APP
- Root directory: .
- Working directory: /Users/princegupta/mykaarma/mykaarma-js-starter-template
- Environment files:
✔ /Users/princegupta/mykaarma/mykaarma-js-starter-template/.env
- Injected keys:
✔ NG_APP_ENV => undefined
✔ NG_APP_HOSTNAME
✔ NG_APP_ROLLOUT_STAGE
✔ NG_APP_VERSION
---------------------------------
✖ NGX_ENV: Cannot read index.html in dist folder
✖ Error: ENOENT: no such file or directory, open '/Users/princegupta/mykaarma/mykaarma-js-starter-template/dist/demo-app/server/index.server.html'
from dotenv-run.
Great, thanks. Looking forward to the fix
from dotenv-run.
Could you test the fix please?
npx ng add @ngx-env/[email protected]
from dotenv-run.
The fix works, thanks. Small question, I am getting this warning only when running ng serve (not during build).
Warning: Forcing the use of the esbuild-based build system with third-party builders may cause unexpected behavior and/or build failures.
The 'browser-esbuild' builder is a compatibility builder which will be removed in a future major version in favor of the 'application' builder.
It should not be causing any issues right ?
from dotenv-run.
Related Issues (20)
- NG_APP_ENV not taken from .env file HOT 2
- How to use with jest? HOT 1
- Problem with module federation HOT 2
- I cannot access my environment variables in my environment.ts HOT 2
- version info for import.meta.env HOT 1
- Thank you for making this HOT 1
- environment variables not being set HOT 2
- ng build throws rxjs switchmap error HOT 5
- Do the `secret` keys get included in the final build? HOT 2
- Document usage with custom builder and @dotenv-run/webpack
- Prepare stackblitz playground
- Support angular workspace for ng-add
- Angular 17 support HOT 8
- Replace variables on pre-rendered pages HOT 4
- Design a logo
- @ngx-env not loading variables HOT 6
- Schema validation failed on `ng serve` HOT 7
- @ngx-env/builder Mistargets File Path for index.server.html. ( Nx + Angular ) monorepo HOT 4
- Add browser-esbuild builder HOT 2
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 dotenv-run.