Skip to content

url options is Function, don't work #1255

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

Closed
noshower opened this issue Feb 5, 2021 · 2 comments · Fixed by #1260
Closed

url options is Function, don't work #1255

noshower opened this issue Feb 5, 2021 · 2 comments · Fixed by #1260

Comments

@noshower
Copy link

noshower commented Feb 5, 2021

  • Operating System: macOS Catalina 10.15.7
  • Node Version: v14.14.0
  • NPM Version: 6.14.8
  • webpack Version: 5.20.2
  • css-loader Version: 5.0.1

my css-loader config:

 options: {
    url: (url) => {
      console.log('url', url);
      return !url.startsWith('/guide/img')
    },
    modules: {
      localIdentName: '[path][name]__[local]--[hash:base64:5]'
    }
  }

Expected Behavior

background-image: url("/guide/img/banWord/addCoinDialogTitleBg.png");

expected : this url dont resolve. because this is http url 。full url likes "http://domain.com/guide/img/banWord/addCoinDialogTitleBg.png"

Actual Behavior

this url resolve. but, throw error 'Error: Can't resolve 'guide/img/banWord/addCoinDialogTitleBg.png''

Other

I found url funciton was never called.

it sees like a bug.

@alexander-akait
Copy link
Member

Here run https://github.com/webpack-contrib/css-loader/blob/master/src/utils.js#L107, it means you check is invalid, unfortunately you don't provide how we can reproduce it, so I can't say what is wrong

@alexander-akait
Copy link
Member

I added test(s) with your example and everything works well, something wrong with the config

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

Successfully merging a pull request may close this issue.

2 participants