Code Monkey home page Code Monkey logo

Comments (10)

chihab avatar chihab commented on June 1, 2024 1

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.

chihab avatar chihab commented on June 1, 2024 1

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.

PrinceGupta1999 avatar PrinceGupta1999 commented on June 1, 2024 1

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.

chihab avatar chihab commented on June 1, 2024

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.

PrinceGupta1999 avatar PrinceGupta1999 commented on June 1, 2024

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.

chihab avatar chihab commented on June 1, 2024

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.

PrinceGupta1999 avatar PrinceGupta1999 commented on June 1, 2024

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.

PrinceGupta1999 avatar PrinceGupta1999 commented on June 1, 2024

Great, thanks. Looking forward to the fix

from dotenv-run.

chihab avatar chihab commented on June 1, 2024

Could you test the fix please?

npx ng add @ngx-env/[email protected]

from dotenv-run.

PrinceGupta1999 avatar PrinceGupta1999 commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.