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

parse the incoming sourcemap from string to json #31

Closed ly710 closed 7 years ago

ly710 commented 7 years ago

When I use resolve-url-loader with less-loader like this: { test: /\.less$/, loader: ExtractTextPlugin.extract("css-loader?sourceMap!resolve-url-loader?sourceMap!less-loader?sourceMap") } I found the incoming sourcemap is typeof string not Object. So I must parse it from string to json that can use it well in conjunction with the less-loader in my project.

bholloway commented 7 years ago

@ly710 thanks for your PR.

I think this is probably a good move regardless of how it emerged in your configuration. However are you confirm that this is solely the result of the less-loader?

If it is not a heap of effort could you please compare against sass-loader or some other known-good use case. Meaning add a small scss file to the same project and, just for that file, substitute sass-loader in the same loader chain.

jessezhang91 commented 7 years ago

This is happening for me for sass-loader as well.

bholloway commented 7 years ago

@jessezhang91 I am concerned about how this is occurring. I need to identify the root cause.

I can understand if it is something new with less-loader but I have never heard of a problem with sass-loader.

Do you have some open-source project, or can you construct a simple example project, that I can work with to debug this?

bholloway commented 7 years ago

@ly710 @jessezhang91 could you please let me know if #45 will fix your issue.

Use npm i resolve-url-loader@bholloway/resolve-url-loader#feature/support-sass-loader-6

jessezhang91 commented 7 years ago

It seems to be working and the sourceMap object is coming in as an object now as well. Thanks!