You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there is however another node_modules in the root of your project, and that name is usually ignored by most tools for testing/linting/indexing because of the large number of dependencies usually installed in there. webpack has a configuration option for specifying the 'root' folder of your project so that all imports from / start at src/, i'll investigate and make a PR because i also need this but have been lazy to add it :)
Just submitted a PR so that we can do import MyComponent from 'components/MyComponet' or import MyComponent from 'MyComponent' if MyComponent is in src :D crossing fingers hoping its accepted
I think one key thing to keep in mind is that whenever there is a node_modules folder without a package.json at the same-level, it is most likely user-generated.
At our organization, the "top-level" of our git package source is located under a src/ directory during our build process, so this would break testing during the build phase since the third-party node_modules would also be installed under this src/ directory from package.json at that same level.
Activity
alphashuro commentedon Nov 15, 2016
i suspect this is expected behavior, since 'node_modules' is actually one of the folders jest is configured to ignore since
spadin commentedon Nov 15, 2016
It makes sense if this is intended behavior, but to be clear, the
node_modulesdirectory I created is undersrcso it only has files I've added.alphashuro commentedon Nov 15, 2016
there is however another
node_modulesin the root of your project, and that name is usually ignored by most tools for testing/linting/indexing because of the large number of dependencies usually installed in there. webpack has a configuration option for specifying the 'root' folder of your project so that all imports from/start atsrc/, i'll investigate and make a PR because i also need this but have been lazy to add it :)alphashuro commentedon Nov 15, 2016
Just submitted a PR so that we can do
import MyComponent from 'components/MyComponet'orimport MyComponent from 'MyComponent'ifMyComponentis insrc:D crossing fingers hoping its acceptedgaearon commentedon Nov 20, 2016
Let's do this (support for
src/node_modules). A PR would be welcome.ianschmitz commentedon Mar 14, 2017
#544 should take care of supporting this case
sparebytes commentedon Mar 24, 2017
I have a similar issue. I'm attempting to run jest from inside the
src/node_modulesdirectory.Eg.
I'm able to run tests after I move
my-packageto somewhere else.AaronHarris commentedon May 1, 2017
I think one key thing to keep in mind is that whenever there is a node_modules folder without a package.json at the same-level, it is most likely user-generated.
At our organization, the "top-level" of our git package source is located under a src/ directory during our build process, so this would break testing during the build phase since the third-party node_modules would also be installed under this src/ directory from package.json at that same level.
gaearon commentedon Jan 8, 2018
Closing in favor of #1333.
We'll likely support Yarn Workspaces and/or Lerna with a top-level
packagesdirectory instead ofsrc/node_modules.