Fuse-box: QuantumPlugin stringifies (deep) objects in EnvPlugin

Created on 18 Aug 2017  路  4Comments  路  Source: fuse-box/fuse-box

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! 馃槃

bug

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hilarycheng picture hilarycheng  路  3Comments

xdave picture xdave  路  5Comments

dzek69 picture dzek69  路  3Comments

calebboyd picture calebboyd  路  5Comments

leon-andria picture leon-andria  路  4Comments