Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create-Plugin: Transform known ES modules in jest config #145

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/

const path = require('path');
// Jest will throw errors if it tries to load an es module with it being transformed first
const esModules = ['ol', 'react-colorful'].join('|');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to update the comment and the name of the variable to reflect more what problems one can solve with adding package names here and when it should be used? Probably it would also make sense to export it so plugin devs can extend it in their own config more easily?

Suggested change
const esModules = ['ol', 'react-colorful'].join('|');
// Just an idea, maybe we can find a better name
const esModuleNpmPackages = ['ol', 'react-colorful'].join('|');


module.exports = {
moduleNameMapper: {
Expand Down Expand Up @@ -35,5 +37,5 @@ module.exports = {
},
],
},
transformIgnorePatterns: [],
transformIgnorePatterns: [`node_modules/(?!(${esModules})/)`],
};