Use loaders on specific node modules

(Corey Snyder) #1

It looks like using the create-react-app that the webpack configuration is setup to not run loaders against node-modules. I have an internal private npm library that I’m including which includes react components. I’m getting errors that I can’t read in these files and I may need to use a loader. So I think one of 2 things has to happen:

  1. Find a way to override the webpack configuration (without ejecting ideally if possible)
  2. Build my shared library into a dist file which can be included that is already compiled using babel. I don’t want to go this route as it means that I have to include the entire library, versus just the pieces of it that I need which is how it works in my angularjs apps that use this library.

If you have any advice let me know!

(Yves Wang) #2

In your shared module dir run npm link or yarn link if you use yarn.

In you project dir, run npm link yoursharedmodelsname