Skip to content

Commit

Permalink
feat: set modules automatically
Browse files Browse the repository at this point in the history
When node_env is test, then set modules to commonjs, otherwise
keep it at false.
  • Loading branch information
swashata committed May 4, 2019
1 parent c1ecbd7 commit 143d0fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-preset-base/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export const preset = (opts: PresetOptions | null = {}) => {

// Create the presets
const presets: babelPreset[] = [
['@babel/preset-env', { modules: false, ...presetEnv }],
[
'@babel/preset-env',
{ modules: env === 'test' ? 'commonjs' : false, ...presetEnv },
],
];
// Add react if needed
if (hasReact) {
Expand Down

0 comments on commit 143d0fd

Please sign in to comment.