Webpack tip: add `modulesDirectories: [‘src’, ‘node_modules’]` to your resolve option in your…
Travis Arnold
11

From experience, be careful with this since it makes your modules not portable if you need to require them outside of your webpack build (i.e. tests, server-side stuff, etc.)

Another approach I’ve seen recommended (though haven’t tried it myself) is to add a symlink in your node_modules directory to your app, then require things like `import foo from ‘app/components/foo’`. This only sucks if you need to do dev on Windows.

Show your support

Clapping shows how much you appreciated Cina Saffary’s story.