Hey,
Thanks for the feedback. Indeed, there is no native reading of environment variables on the client side. I will add this point for the next version.
In the meantime, you can insert it in Webpack. For that:
- Install webpack (take the same version of the compiler as RPGJS to avoid incompatibility)
npm i webpack@4.44.1 -D
- In
webpack.config.js
:
const webpack = require('webpack')
const webpackCompiler = require('@rpgjs/compiler')
const [clientConfig, serverConfig] = webpackCompiler(__dirname)
module.exports = [
{
...clientConfig,
plugins: [
...clientConfig.plugins,
new webpack.EnvironmentPlugin(['SERVER_URL', 'APPLICATION_ID'])
]
},
serverConfig
]