cypress-io / instrument-cra

Little module for CRA applications to instrument code without ejecting react-scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React-scripts flag vs customize-cra

zorgick opened this issue · comments

Hi, my question is about integrating your package into react-scripts process.

I've looked through the react-scripts code, but I didn't find any notice about the -r argument, that your package relies on.

So, I have some considerations, whether your decision to use that flag is more reliable, than to use react-app-rewired with customize-cra and separate babelrc config.

Also, could you, please, tell me, where exactly did you find that flag?

Look at the code in https://github.com/facebook/create-react-app/blob/0ee4765c39f820e5f4820abf4bf2e47b3324da7f/packages/react-scripts/bin/react-scripts.js#L21-L33 and trace what happens when you call react-scripts -r moduleName start for example - it runs Node with -r moduleName then the react scripts JS file

Yes, I see now. I lack knowledge in node arguments. Apparently, I thought that the flag belongs to react-scripts, not directly to node. Thanks for the help!

@bahmutov Although, I have a problem that have already been mentioned in issues. Here, nyc.exclude rule in package.json is ignored, when this package is used with react-scripts.

However, if I use react-app-wired with customize-cra and babel-plugin-istanbul in a separate .babelrc file, everything works as expected, and the coverage is not collected for excluded files.