We've been using TSDX for Redux Toolkit, which currently generates 3 CommonJS files: index.js, redux-toolkit.cjs.development.js, and redux-toolkit.cjs.production.js.
The index.js file looks like:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./redux-toolkit.cjs.production.min.js')
} else {
module.exports = require('./redux-toolkit.cjs.development.js')
}
In package.json, we've got main: ./dist/index.js pointing to that file.
I'm playing around with Microbundle for the first time, and it looks like it isn't really set up to do that kind of pattern. So, questions:
- Is there a way to get Microbundle to output both dev and prod CJS builds like that?
- Is that "build both, import the right one at runtime" approach even something we would want?
Curious for any info folks can provide on how to set things up the right way here.
We've been using TSDX for Redux Toolkit, which currently generates 3 CommonJS files:
index.js,redux-toolkit.cjs.development.js, andredux-toolkit.cjs.production.js.The
index.jsfile looks like:In
package.json, we've gotmain: ./dist/index.jspointing to that file.I'm playing around with Microbundle for the first time, and it looks like it isn't really set up to do that kind of pattern. So, questions:
Curious for any info folks can provide on how to set things up the right way here.