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

CRA config no babelrc for jest #11

Open
bastian-hidalgo opened this issue Oct 5, 2020 · 1 comment
Open

CRA config no babelrc for jest #11

bastian-hidalgo opened this issue Oct 5, 2020 · 1 comment

Comments

@bastian-hidalgo
Copy link

For those who need help with CRA and i18next for example and no need of babelrc configuration:

import registerRequireContextHook from 'babel-plugin-require-context-hook/register';

registerRequireContextHook();

const req =
  process.env.NODE_ENV === 'test'
    ? __requireContext(__dirname, '..', true, /i18n\.js$/)
    : require.context('..', true, /i18n\.js$/);

function loadRequires() {
  req.keys().forEach((filename) => req(filename));
}

loadRequires();

@pke
Copy link

pke commented May 13, 2022

@bastian-hidalgo this will throw module "path" not found in my React Native app. I thought this is run on the bundler side (node) and not inside the devices script engine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants