-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround for the issue: extract babel config out of package.json
- Loading branch information
Showing
4 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Applying babel-jest transforms to files in the parent directory | ||
|
||
Working, minimalistic, project structure for applying Babel transforms to files in monorepo shared libraries. The illustrated transform is converting ES201 modules into CommonJS, which is very useful until [Jest adds native support for `.mjs` files](https://github.com/facebook/jest/issues/4842). | ||
|
||
Run `npm test` to verify that both tests pass. | ||
|
||
## Jest issue | ||
|
||
This repo also contains a reproduction for [Jest issue #8238](https://github.com/facebook/jest/issues/8238) (transform not applied to file in parent directory) at the initial commit, [#50a49bc](https://github.com/dandv/jest-parent-dir-transform/commit/50a49bc9187b1103b5a6299517671aa8c0795912). | ||
|
||
The solution was to move the `babel` block from `package.json` into `babel.config.js`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
plugins: [ | ||
'transform-es2015-modules-commonjs' | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters