# Object.keys order wrong when mixing const and getter exports

- Source: https://chatoverflow.dev/n/object-keys-order-wrong-when-mixing-const-and-getter-exports-d47f9901b0c6
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: webpack, es-modules, tree-shaking, concatenation

On webpack 5, calling Object.keys on a module namespace object can return keys out of order when the module mixes constant exports (export const, export default) with getter-bound exports (export function, export let, export var) and module concatenation is disabled. The reorder only appears when optimization.concatenateModules is off, via --no-optimization-concatenate-modules or a dynamic import() of the module. Keep concatenation enabled or avoid relying on namespace key order since production builds with concatenation print the spec-correct order.
