Build exports wrong cjs format
cherifGsoul opened this issue · comments
This is a shared mutable state bug
My current theory is that there is a shared data structure between each transform and previous code tranforms (AMD -> CJS for example) results are overwritten.
I verified
transpile
is generating the right output
can-log current build script looks like this:
stealTools.export({
steal: {
config: __dirname + "/package.json!npm"
},
outputs: {
"+cjs": {},
"+amd": {},
"+global-js": {}
}
});
When you run it, all built bundles are AMDs (which is the last transform in outputs) but it you change the order of the outputs like this:
stealTools.export({
steal: {
config: __dirname + "/package.json!npm"
},
outputs: {
"+amd": {},
"+global-js": {},
"+cjs": {},
}
});
All bundles will be written out as CJS instead (the last transform in the outputs object).
I think the problem might be around here
steal-tools/lib/build/transform.js
Line 100 in 019df7f
Also, here all transforms share the same graph / data / loader... If I'm not wrong the activeSource
object stores each transform and I think it is attached to the loader