Skip to content

Commit aef6c2b

Browse files
committed
fix: Use statically analyzable CJS exports
This enables named imports in node ESM scripts because they do some magic to detect which module is exported.
1 parent a3cc1c1 commit aef6c2b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/history/node-main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* eslint-env node */
2-
module.exports =
3-
process.env.NODE_ENV === 'production'
4-
? require('./umd/history.production.min.js')
5-
: require('./umd/history.development.js');
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('./umd/history.production.min.js');
5+
} else {
6+
module.exports = require('./umd/history.development.js');
7+
}

scripts/rollup/history.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const node = [
198198
file: `${OUTPUT_DIR}/main.js`,
199199
format: 'cjs'
200200
},
201-
plugins: [compiler()].concat(PRETTY ? prettier({ parser: 'babel' }) : [])
201+
plugins: PRETTY ? prettier({ parser: 'babel' }) : []
202202
}
203203
];
204204

0 commit comments

Comments
 (0)