You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the following instructions to configure environment variables in an Angular project, we need to provide a custom webpack configuration, but in my case the plugins array in config object is undefined, for that reason NX project cannot be executed. Please update your documentation to add the following initialization: config.plugins = config.plugins || [];
The complete code will be:
function getClientEnvironment() {
const envVars = {};
for (const key in process.env) {
envVars[key] = process.env[key];
}
return {
'process.env': JSON.stringify(envVars),
};
}
module.exports = (config, options, context) => {
// Overwrite the mode set by Angular if the NODE_ENV is set
config.mode = process.env.NODE_ENV || config.mode;
config.plugins = config.plugins || [];
config.plugins.push(new webpack.DefinePlugin(getClientEnvironment()));
return config;
};
According to the following instructions to configure environment variables in an Angular project, we need to provide a custom webpack configuration, but in my case the plugins array in config object is undefined, for that reason NX project cannot be executed. Please update your documentation to add the following initialization:
config.plugins = config.plugins || [];
The complete code will be:
My packages are:
https://nx.dev/recipes/angular/use-environment-variables-in-angular#use-a-custom-webpack-configuration-to-support-environment-variables
The text was updated successfully, but these errors were encountered: