Skip to content

Commit

Permalink
fix: Use statically analyzable CJS exports
Browse files Browse the repository at this point in the history
This enables named imports in node ESM scripts because they do some magic to detect which module is exported.
  • Loading branch information
mjackson committed Dec 17, 2021
1 parent a3cc1c1 commit aef6c2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/history/node-main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-env node */
module.exports =
process.env.NODE_ENV === 'production'
? require('./umd/history.production.min.js')
: require('./umd/history.development.js');

if (process.env.NODE_ENV === 'production') {
module.exports = require('./umd/history.production.min.js');
} else {
module.exports = require('./umd/history.development.js');
}
2 changes: 1 addition & 1 deletion scripts/rollup/history.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const node = [
file: `${OUTPUT_DIR}/main.js`,
format: 'cjs'
},
plugins: [compiler()].concat(PRETTY ? prettier({ parser: 'babel' }) : [])
plugins: PRETTY ? prettier({ parser: 'babel' }) : []
}
];

Expand Down

0 comments on commit aef6c2b

Please sign in to comment.