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

Error when using the string "url" in my css #157

Closed stefanholzapfel closed 3 years ago

stefanholzapfel commented 3 years ago

When I use the string "url" in my css, I get the following error when bundling:

ERROR in Module build failed (from C:/_Workspaces/mypath/node_modules/resolve-url-loader/index.js):
Error: resolve-url-loader: CSS error
  source-map information is not available at url() declaration (found orphan CR, try removeCR option)
  at file://C:\_Workspaces\mypath\mycomponent.scss:57:3
    at encodeError (C:\_Workspaces\mypath\node_modules\resolve-url-loader\index.js:219:12)
    at onFailure (C:\_Workspaces\mypath\node_modules\resolve-url-loader\index.js:176:14)

I came across that problem because I have a css class name that contains the word "hourly".

Interestingly that happens on my machine running Windows10, but my colleague who is on Ubuntu has no problems bundling.

I use the resolve-ur-loader in an Angular 10 App with Wepback 4. Other dependencies that may be relevant:

"node-sass": "^4.14.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^9.0.2",
"style-loader": "^1.2.1",
"css-loader": "^3.6.0"

Update: That seem to happen ONLY when the string appears within a @mixin that is @included.

bholloway commented 3 years ago

@stefanholzapfel Have you tried the removeCR option?

stefanholzapfel commented 3 years ago

@bholloway thx for respone.

What is the removeCr option?

I have manually checked if there are any orphan CRs and also tried to replaye with linux LFs, makes no difference.

I ended up renaming all classes so they don't contain "url" strings.

bholloway commented 3 years ago

Please let me know if you wish to re-open.

stefanholzapfel commented 3 years ago

@bholloway Thanks, I worked around the issue by renaming my classes. But maybe relevant to others that may stumble accross that issue.