0

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

hamada
  • 1
  • 1
  • You really need to expand this question - perhaps tell us what outcome you're trying to achieve? This question right now doesn't make much sense. `process.env.PORT` is a back-end feature of node.js, whereas stenciljs builds front-end components... – Squiggle Jul 19 '18 at 12:39

1 Answers1

1

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.