a need to disable propTypes removal for some node modules #36584
-
Hey there. I have a node_module that is using the propTypes in order to detect which properties or owned by a particular component. Until that problem can be dealt with in a better, I need to stop the The following hack does what I want:
Obviously, having to change a core gatsby module like this is not great. I've tried the following without success:
However, plugins are applied before presets, and the presets in babel-preset-gatsby override the options for that plugin. I am wondering. Would it be possible to expose the ignoreFilenames as an option that can be set on the babel-preset-gatsby module. Something that could be applied something like this would be great:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Hi! Have you tried using This calls this here: gatsby/packages/gatsby/src/redux/actions/public.js Lines 1186 to 1207 in 1a8c5d5 Which subsequently calls this here: It uses lodash merge (https://lodash.com/docs/4.17.15#merge) so you should be able to override the option in the preset. Also wrap your stage === "build-javascript" |
Beta Was this translation helpful? Give feedback.
-
FWIW, I did try using the following options among others:
Both didn't work. |
Beta Was this translation helpful? Give feedback.
-
As it stands, this issue is a blocker for my using gatsby for production work right now. I have submitted a proposed change to at least provide a workaround until we can fix our libraries to operate without propTypes at #36586. |
Beta Was this translation helpful? Give feedback.
-
Hi! We've looked at this again and yes, indeed, your PR would be necessary to be able to override this. However, we won't merge it as allowing this would be a huge anti-pattern and we don't want to allow that. Please use https://www.npmjs.com/package/patch-package until you can fix the root cause of your issue. |
Beta Was this translation helpful? Give feedback.
Hi!
We've looked at this again and yes, indeed, your PR would be necessary to be able to override this. However, we won't merge it as allowing this would be a huge anti-pattern and we don't want to allow that.
Please use https://www.npmjs.com/package/patch-package until you can fix the root cause of your issue.