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

require .png works in chrome but not firefox #1668

Closed
littlebee opened this issue Nov 24, 2015 · 2 comments
Closed

require .png works in chrome but not firefox #1668

littlebee opened this issue Nov 24, 2015 · 2 comments
Labels

Comments

@littlebee
Copy link

I'm not sure what I've done, but I have this image:

notFoundUrl: require("../../img/petals.png")

That webpack seems to find and load just fine in Chrome but not in Firefox. My webpack loader config looks like:

      ,
        test: /\.(png|jpg)$/
        loader: 'url-loader?limit=8192' # inline base64 URLs for <=8k images, direct URLs for the rest

See for example: (http://zulily.github.io/react-datum/docs/examples/). The last two tiles on the left should have the petals.png image but show as broken, and render without a src on Firefox. I tested with two different machines with Firefox 42 and one hopelessly stuck on 36.

Thank you for your help.

@littlebee
Copy link
Author

I did a bit more debugging on this issue. In Firefox, the base64 encoded 'url' looks quite different on Firefox and Chrome debuggers.
In Chome, the module exports returned from webpack_require(24) =

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABoCAYAAAAHIFUvAAAAGXRFW…dk7GCMERBgUpCgmqJbQEcPxlgBIVDohNbFrwJGR/8XYAA/IBnrVTxJagAAAABJRU5ErkJggg=="

In Firefox, the same method returns a much bigger image src that displays renders in the DOM with the image tag having src=""

Interestingly, I tried setting the Chrome image src to the data above in firebug console and, viola, petals. See attach screenshot and text file for the full firefox base64 data.

I tried to just hard code the chrome value in source code but that didn't work either on firefox.

inspector_-_http___zulily_github_io_react-datum_docs_examples__bigkittens_and_react-datum_and_documents

webpackImageData.txt

@littlebee
Copy link
Author

This issue was moved to webpack-contrib/url-loader#20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants