bholloway / resolve-url-loader

Webpack loader that resolves relative paths in url() statements based on the original source file
563 stars 71 forks source link

query string and hash not working #40

Closed craigcosmo closed 7 years ago

craigcosmo commented 7 years ago

my config

{
    test: /\.(scss)$/,
    loader: ExtractTextPlugin.extract(
        'style?sourceMap',
        'css?sourceMap&modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]',
        'resolve-url?keepQuery',
        'sass?sourceMap'
    )
},

my css code

.lego{
    font-size: 100px;
    background: url('image/game.png');
}

actual output

.lego___126xF {
    font-size: 100px;
    background: url(http://localhost:1112/dist/development//image/game.png);
}

reproducing: https://github.com/craigcosmo/url-resolve-bug

bholloway commented 7 years ago

I'm not seeing anything with a query string or hash. Are you saying that this example stops working only when you use the keepQuery option?

There's also a lot in webpack config that could be wrong. Can you confirm this works as a pure CSS file without SASS and resolve Url loaders?

craigcosmo commented 7 years ago

Hi, With keepquery on, my file name game.png should become like game.png?dr5t67u9ac343224 right? Or Am i misunderstanding?

bholloway commented 7 years ago

Can you update your example to show such a query string. It is not in your CSS.

craigcosmo commented 7 years ago

Can you clarify this, the keepquery option is to keep the query string in file name intact, It does not generate query string for file name?

craigcosmo commented 7 years ago

Now I understand, this is not a bug.

bholloway commented 7 years ago

You are correct. The option only keeps the query or hash, it does not generate one.

This loader simply allows webpack to find your asset. Then loaders for the given asset type will run.

It sounds like you may want cache busting. If so then that can be done using the hash feature in the file loader.