When using the QuantumPlugin after the EnvPlugin, it appears to stringify deeply nested object properties. Eg.
const env = {
NODE_ENV,
config: {
key: 'value',
anotherKey: false,
}
}
// ...
plugins: [
EnvPlugin(env),
isProduction && QuantumPlugin(),
]
// ...
Result when isProduction === false:
console.log(process.env.NODE_ENV) // 'development'
console.log(process.env.config) // { key: 'value', anotherKey: false }
Result when isProduction === true:
console.log(process.env.NODE_ENV) // 'development'
console.log(process.env.config) // [object Object]
Bug or Feature?
Thanks for making my builds stupid fast, btw! 馃槃
Np :) that's a bug Quantum replaces the values at build time, and we don't support replacing objects just yet
Ah ok, makes sense. I'll avoid objects for now then. Feel free to close this issue if you don't need it for reference. 馃憤
@miickel i will keep it open and see it fixed in the next release ;-) it's not a big issue
@miickel hey, I have finally investigated the issue.
process.env.FOOOOO = { foo: 1 }
console.log(typeof process.env.FOOOOO, process.env.FOOOOO)
Turns out, whatever you assign to process.env is becoming a string. And it's understandable, as these variables are agnostic to the environment, meaning that they are being read from the user's PATH.
I can't really fix it.