-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Unexpected token (7:2) You may need an appropriate loader to handle this file type. #637
Comments
It would be great if you could share the project reproducing the issue. |
It is the file as created by the tool. It's content is:
I attach a zip file of the project: Guido |
Seeing this too on a similar setup:
All I did was create the app and run |
Did some digging. In my case it's a symlink issue. If |
Will try to dive in and work on a PR. |
I trashed the node_modules directory, ran I then ran So, as far as I am concerned, this issue is solved. FWIW, I'm running on windows, so my problem may not have been caused by a symlink, I don'y know. |
I am still getting a "You may need an appropriate loader to handle this file type." with a symlink'ed folder in |
Nevermind, my issue seems to be in the lines of webpack/webpack#2937 |
It was fixed but not released. You can see the issue is tagged with a milestone. When the related milestone is released, you will see it on the GitHub Releases page and in the CHANGELOG.MD. |
This should be fixed in 0.4.2. |
@gaearon My comment was based on master, but either way I think my problem is (somewhat) unrelated. I wanted to symlink a "shared" library in my project but ran into some issues with babel and npm using the symlink'ed folder absolute path and not the path where the symlink is (so loaders did not process the files in the shared folder, and npm module resolution was happening in the shared folder hierarchy). Not a problem with react-create-app; sorry for the confusion! |
* Resolve app paths from realpath of CWD, fix facebook#637 * Use new resolveApp() for NODE_PATH too
I had this error and it was because I created my components folder outside the src folder. Once I moved it inside src everything worked fine. I just wanted to drop my amateur mistake and solution here just in case someone comes across it in the future. |
@jturbo26 What if you are importing a component that lives in a separate dir outside of src? Say in the case when you have more than one app sharing a component? I'm running into this error and there is no real solution, I don't want to bring the component into src because it's supposed to exist separately. |
@leshow It’s just not supported right now, sorry. There are a dozen issues about this, and we intend to solve it in some way in the future, but for now we don’t have a good solution for sharing components between several apps locally with CRA. |
Is there a recommended path to get it working if you eject? I was able to
yarn link a local package and add it's directory in babel-loader, but I'm
not sure if there's an easier way.
On 27 Feb 2017 3:21 pm, "Dan Abramov" <notifications@github.com> wrote:
@leshow <https://github.com/leshow> It’s just not supported right now,
sorry. There are a dozen issues about this, and we intend to solve it in
some way in the future, but for now we don’t have a good solution for
sharing components between several apps locally with CRA.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#637 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABE3bpMx2d21TdO7_pb6qxqsm2oKXEXAks5rgzBMgaJpZM4J7jeJ>
.
|
You can change the |
Believe it or not, my issue was the commented code at the end of the file:
Removing it, or fully commenting it like so:
..fixes the issue |
I'm trying to import a react component button.js file from node_modules which is a component made by me to be shared between projects and I get You may need an appropriate loader to handle this file type. using create-react-app.. any ideas? |
My amateur issue -> somehow WebStorm acted like it created a JS file, but in reality, when checked inside explorer, the file was not JS... |
This is an old issue that was fixed. Adding comments here is like shouting in the void :-) If you experience a problem with the same symptom (but a different cause) please file a new issue, describe it in detail and provide a reproducing case. |
Ran
create-react-app react-my-create-react-app-created
followed by
npm start
with this error result:
and here's the devtools console output:
npm version is 3.10.4
node version ia v6.3.1
Please advise
The text was updated successfully, but these errors were encountered: