Currently my Angular project uses a custom webpack configuration file.
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"allowedCommonJsDependencies": [
...
],
"customWebpackConfig": {
"path": "./angular-webpack.config.js",
"mergeRules": {
"module": {
"rules": "prepend"
}
}
},
And inside my custom configuration I am using some custom environment variables from mt build.
But I want to move over to esbuild, but the issue is that I can't find any good/obvious way to have some custom esbuild config for Angular.
let DefinePlugin = require('webpack/lib/DefinePlugin');
let OS = require('os');
module.exports = {
plugins: [
new DefinePlugin({
VERSION: JSON.stringify(process.env.VERSION || OS.hostname()),
URL: JSON.stringify(process.env.URL || ''),
}),
],
}
Any help or tips are appreciated of how I should go about implementing custom defined environment variables for Angular esbuild.
Thank you.