Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unejected version does not work for a subdirectory of another npm module #19

Closed
lacker opened this issue Jul 18, 2016 · 11 comments · Fixed by #27
Closed

unejected version does not work for a subdirectory of another npm module #19

lacker opened this issue Jul 18, 2016 · 11 comments · Fixed by #27
Milestone

Comments

@lacker
Copy link
Contributor

lacker commented Jul 18, 2016

I tried create-react-app in a subdirectory of a different project. It did not work. Then when I ejected, it worked. It might be related to the file:/// thing - just filing an issue to get this recorded.

@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

Can you be more precise for "it didn't work"?

@gaearon
Copy link
Contributor

gaearon commented Jul 18, 2016

I tried create-react-app in a subdirectory of a different project.

How did you do it?

@lacker
Copy link
Contributor Author

lacker commented Jul 18, 2016

$ npm run create-react-app ../graphql-hacks/foobar
cd ../graphql-hacks/foobar
npm start

And then it failed with a bunch of errors similar to "Module not found: Error: Cannot resolve module 'webpack-dev-server/client' in /Users/lacker/graphql-hacks/foobar".

graphql-hacks in this case already has a package.json. When I ejected, it worked. The resulting functional post-eject code is at https://github.com/lacker/graphql-hacks/tree/master/fromscratch if you are curious to see it.

@gaearon
Copy link
Contributor

gaearon commented Jul 18, 2016

Oh, this is not supported (the argument is supposed to be the project name, not a path).
Maybe we should throw if it contains a slash to keep it simple.

@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

@gaearon the cli is designed to work with a path. I think the issue is the isNodeModules detection

@gaearon gaearon added this to the 0.1.0 milestone Jul 18, 2016
@vjeux
Copy link
Contributor

vjeux commented Jul 18, 2016

I've tried it inside of jest ( https://github.com/facebook/jest ) and it throws with Cannot find module 'babel-eslint'. For some reason it reads the .babelrc file of jest instead of the one that is provided by the babel-loader. I'm trying to figure out what's going on.

@gaearon
Copy link
Contributor

gaearon commented Jul 18, 2016

Interesting. Maybe Babel still looks for .babelrc even though we're giving a config to babel-loader in a query. Perhaps it tries to merge them or something.

@gaearon
Copy link
Contributor

gaearon commented Jul 19, 2016

Okay, I got the Jest case working locally. It happens because of eslint config being autodiscovered. The only fix I found so far is to just embed the whole config into Webpack config, and pass useEslintrc: false.

Since we plan to maintain our own anyway, I’ll try to get this working.

@lacker
Copy link
Contributor Author

lacker commented Jul 19, 2016

I can reproduce the same problem if I just create it in a new directory that has no eslint. To get this I just did npm run create-react-app ~/blarg and then it could not find babel or webpack-dev-server/client. Does that work for you guys?
screen shot 2016-07-19 at 2 32 30 pm

@gaearon
Copy link
Contributor

gaearon commented Jul 19, 2016

@lacker Can you still reproduce this with master? It works for me:

screen shot 2016-07-20 at 00 27 43

@lacker
Copy link
Contributor Author

lacker commented Jul 19, 2016

Still doesn't work for me, but I'll open a new issue with more specific info.

@lock lock bot locked and limited conversation to collaborators Jan 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants