-
-
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
Inconsistent "Relative imports outside of src/" restriction ? #5402
Comments
Ok finally the issue is different. The problem is :
Both pass through webpack so the behaviour should be the same ? |
One is detecting the symlink and the other is not, we'll need to look into this. |
Do you need the tilda, ie |
@bugzpodder, It does not seem to work. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
It looks like this is a case of "Problems with |
This is not a create-react-app/packages/react-scripts/config/webpack.config.js Lines 283 to 288 in eee8491
|
I'm pretty sure CRA does support loading files outside of the It looks like I may have misread this issue, as it does not actually use It looks like there is still an issue with |
I noticed that in CRA3, if This happened while I was migrating CRA2 to CRA3. Removing Posting here in case someone stumbles over the same issue. |
@hugomallet can you reproduce this issue with latest CRA? #5829 was merged |
hey , 2 |
?? |
@aimadghssisse files outside |
I came here while trying to debug a very mysterious issue and I just wanted to make it clear to future devs what the issue is and how to solve it should they run in to it. In my App.css, at the top of the file, I was importing a css from a separate package: @import "~markdown-it-music/renderers/renderer.css"; Everything works, but then I wanted to link markdown-it-music into my project, so I ran: $ npm link markdown-it-music At this point, my build was failing with: Module not found: You attempted to import ../../../markdown-it-music/renderers/renderer.css which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. I was able to work around this by removing the import from App.css and updating App.js as follows: import "markdown-it-music/renderers/renderer.css";
import "./App.css"; Now the build works on a clean install, or when a node package is linked. |
Does anybody have a solution? i have the same problem my images are in public/images folder and I am importing them to src/components/header/index.js file, but it is showing me the same error. |
@shadanan This is the exact same behavior I am experiencing, and the workaround you describe works. But I'm now curious if anyone knows why this is - why we can we import from a symlink in .js files but not .css files? |
Having the same problem of not being to able to import css from a symlinked project into .css file. Wondering if anyone found a solution to this? |
I fixed this by installing react-rewired along with customize-cra Create the file
|
Is this a bug report?
Maybe not
Which terms did you search for in User Guide?
This is related to my previous answer : #1333 (comment)
Steps to Reproduce
I have a projet which imports an other "private" package. I am using sass in both packages. The private package is passed to babel only (not node-sass).
I have something like the following in the private module :
Then in the main project, if i do this :
everything works fine, but if i do "the same thing" from my sass file :
i obtain the following error :
Expected Behavior
Both import should fail or success ?
To be able to split my project, i would like to be able to import other packages components and sass files.
Actual Behavior
Importing from sass from sass fails but importing sass from js works.
The text was updated successfully, but these errors were encountered: