-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Webpack inline loader syntax not working #747
Comments
Hey! I think the behaviour is the wrong way in CodeSandbox, currently you will get raw text by using Oh wait, no I know what you mean. The raw loader is behaving wrongly for binary files. Ah that totally makes sense. I can make a fix for this tonight! |
Hey, that's great! Looking forward to it! |
Hey @davestewart , I can't reproduce this, it seems to work here: https://codesandbox.io/s/v619vmqzl5 . Do you have another reproduction URL, as I see that https://codesandbox.io/s/github/davestewart/vuex-pathify/tree/develop/demo?initialpath=api/properties already has svg files renamed to @CompuIves Did you fix this and forgot to comment on / close this issue? 😄 |
Hey @lbogdan Thanks for looking at this! Hmm, that's reassuring it works for you, but perplexing it doesn't work for me. Here's a temp branch with the originally-named svg files: Check It doesn't work for me. Perhaps this is something to do with my webpack setup? TBH, I don't really understand how CS works with webpack - some things seem to work, some things don't (is it documented anywhere?). Perhaps my setup isn't working properly with CS? |
CS uses some kind of internal webpack configs, defined for each template ( Also, regarding #733, you can also see the aliases there, at lines 41-44. |
Ah! So that's why my webpack config wasn't running! Thanks for explaining that one :) |
After a bit more digging around, it seems that .svg files are imported as binary from github (as they're basically considered images), meaning that they actually contain the URL (e.g. https://rawgit.com/davestewart/vuex-pathify/c0cb454cb7dc341727ad562c5227fcda7158d4b5/demo/src/assets/svg/travel/balloon.svg ) instead of the actual SVG text contents, so @CompuIves Should we maybe import SVGs as not binary? Or should we make |
Made a naive approach to fix this here #770 . You can test your branch with the originally named svg files here http://pr770.cs.lbogdan.tk/s/github/davestewart/vuex-pathify/tree/temp/svg/demo?initialpath=#/api/properties . |
Oii sorry I let this slip. Your solution is good @lbogdan, however I think it would be nice to send the |
Yeah, the PR was more to illustrate the idea, not necessarily to be merged. Reopened. |
Hey @lbogdan @CompuIves - did this get deployed? I'm getting the original behaviour still: |
Hey @davestewart , Unfortunately the PR was merged and then reverted, because it broke backwards compatibility - in |
That's a shame, thanks for the info though. One for the feature list! |
But instead of using a webpack loader, knowing that when you import an .svg you get its URL, can't you load its contents on the application side? |
I could load it async, but I think the extra code added to the demo would begin to overshadow the original point. It's on the edge as it is! Thanks though :) |
I'm working on an export feature for Guppy and at the default CRA app the spinning svg is not loading - see this sandbox Changing the file to a text file ending |
Hey @AWolf81, that's so cool! I'm deploying a fix for this in a minute, it seems like the wrong URL was returned. |
Is it supposed to be possible to use the I just get |
Hey @glen-84 ,
Can you please point us to a sandbox experiencing that issue? |
I just got hit by this as well for some of my workshops. Here's a small example of something that works locally, but not in codesandbox: https://codesandbox.io/s/sharp-satoshi-f6iz2 |
Better late than never 🚀 This has been fixed |
Good news! Hooray! |
Afternoon @CompuIves
I have a need to load in the text of an SVG so I can manipulate the curves. As such, I'm trying to use the raw-loader to load in the text verbatim.
Locally, I can force the loader for the required resource using
!!raw-loader!./path/to.svg
:However, in CodeSandbox, rather than loading the raw SVG as below...
... you see the text
https://rawgit.com/davestewart/vuex-pathify/50eb7783457e6d1dcd438c8b41a43d1eed458759/demo/src/assets/svg/sunrise.svg
:In another branch, I renamed the SVGs to
.svg.txt
to see if that would work, and it did, but I'd rather not rename files if possible:I'm no webpack expert, I have a working knowledge, and just piece things together as I need them.
Do you know how to work around this?
Many thanks :)
The text was updated successfully, but these errors were encountered: