Skip to content

Commit

Permalink
Add @babel/preset-env
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed May 14, 2021
1 parent 216aab9 commit ba01441
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ module.exports = {
module.exports = {
preset: "solid-jest/preset/node"
};
```
```

For the Node preset, by default ESmodules are converted to CommonJS. If you want to change this behavior, set `process.env.BABEL_CJS` to `false`.
2 changes: 1 addition & 1 deletion preset/browser/transform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const babelJest = require("babel-jest");

module.exports = babelJest.createTransformer({
presets: ["babel-preset-solid", "@babel/preset-typescript"]
presets: ["babel-preset-solid", "@babel/preset-typescript", "@babel/preset-env"]
});
11 changes: 10 additions & 1 deletion preset/node/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ module.exports = babelJest.createTransformer({
hydratable: true
}
],
"@babel/preset-typescript"
"@babel/preset-typescript",
[
"@babel/preset-env",
{
targets: {
node: "current",
esmodules: process.env.BABEL_CJS !== undefined ? process.env.BABEL_CJS : false
}
}
]
]
});

0 comments on commit ba01441

Please sign in to comment.