Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

URL Loader Invalid Options #262

Closed
PrudhviRaj5 opened this issue Nov 29, 2017 · 4 comments
Closed

URL Loader Invalid Options #262

PrudhviRaj5 opened this issue Nov 29, 2017 · 4 comments
Labels

Comments

@PrudhviRaj5
Copy link
Contributor

PrudhviRaj5 commented Nov 29, 2017

Hi, I'm facing URL loader issue. Can you please add how to import the following from assets folder as an example?

  1. .png/.jpg for image file
  2. .svg for vector image
  3. .woff for fonts

This is the error I'm getting while importing a logo.png:

ERROR in ./app/assets/images/logo.png
Module build failed: Validation Error

URL Loader Invalid Options

options.limit should be number
@PrudhviRaj5
Copy link
Contributor Author

I found the solution to it. I changed webpack config to this, and voila it started working!

{
    test: /\.(png|jpg|gif)$/,
    use: [
        {
            loader: 'url-loader',
            options: {
                limit: 8192,
                mimetype: 'image/png',
                name: 'images/[name].[ext]',
            }
        }
    ],
}

I will send a pull request on this. Please check and merge it if it looks good enough for you :)

@KleoPetroff
Copy link
Owner

KleoPetroff commented Nov 29, 2017

Hey @PrudhviRaj5, thanks for issuing the bug. I'm using the shorthand syntax, which may have been changed in the new versions. Have you tried loading a font (.eot, .woff or .otf)? Fonts are using url-loader too and I guess they'll throw the same error.

Looking forward to your PR 🙂

@PrudhviRaj5
Copy link
Contributor Author

Hi @KleoPetroff, I have created a Pull Request and the change are:

  1. change in url and file loader config,
  2. added jest configs for handling images, fonts and etc. (this includes moving shim.js)
  3. and upgraded package.json

Please review my pull request and merge it. After merging you can close this issue.
I want to give a heads up to you. I will send couple more pull requests which might deal with history fallback and redux 🙂

@KleoPetroff
Copy link
Owner

Thank you for taking the time on this, I'll make sure to review the PR tomorrow. As for Redux, I want to give people the freedom to choose the state manager by themselves. That's one of the reasons why the Redux integration didn't happen by now. That being said, I'm totally fine with a separate branch, which includes Redux. You can check the discussion in #83

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

No branches or pull requests

2 participants