How to set process.env.PORT on Stencil-JS app

1.1k Views Asked by At

Does anyone know the proper way to edit the process.env.PORT property in a StencilJS app?

1

There are 1 best solutions below

0
On

You can use rollup-plugin-replace like that:
In stencil.config.js:

import replace from 'rollup-plugin-replace';
...
plugins: [
  replace({
    'PROD_URL': process.env.PROD_URL || 'http://localhost:8080',
    'DEV_URL': process.env.DEV_URL || 'http://localhost:7070',
  }),
  ...
]

After that in your application you could use 'PROD_URL' and that string would be replace to your process.env variable.