Imported in main.scss “@import “common/fonts”;” but never used the font yet
Executed “npm run build” and will result to error.
ERROR Failed to compile with 2 errors
error in ./resources/assets/styles/main.scss
Module build failed: ModuleBuildError: Module build failed: Error: resolve-url-loader: CSS error
predicate must return an absolute path or the result of calling next()
I am having the same problem too.
sage 9.0.10
main.scss: .main { background-image: url(../images/1a.jpg);
yarn build gets an error:
ERROR Failed to compile with 2 errors 23:32:48 error in ./resources/assets/styles/main.scss ERROR Failed to compile with 2 errors 23:32:48 error in ./resources/assets/styles/main.scss Module build failed: ModuleBuildError: Module build failed: Error: resolve-url-loader: CSS error predicate must return an absolute path or the result of calling next() at file:///Users/m/Sites/bedrock/web/app/themes/sage/resources/assets/styles/main.scss:9544:3 at encodeError (/Users/m/Sites/bedrock/web/app/themes/sage/node_modules/resolve-url-loader/index.js:219:12) at onFailure (/Users/m/Sites/bedrock/web/app/themes/sage/node_modules/resolve-url-loader/index.js:176:14) at /Users/m/Sites/bedrock/web/app/themes/sage/node_modules/webpack/lib/NormalModule.js:195:19 at /Users/m/Sites/bedrock/web/app/themes/sage/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /Users/m/Sites/bedrock/web/app/themes/sage/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/Users/m/Sites/sage/web/app/themes/sage/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at onFailure (/Users/m/Sites/bedrock/web/app/themes/sage/node_modules/resolve-url-loader/index.js:176:5)
I tried main.scss: background-image: url(../../images/1a.jpg);
But the problem is, there’s a lot of npm dependencies out there that also use relative paths. So there’s only one option if you happen to depend on such a npm package, and that is downgrading to sage 9.0.9.
I have created over a dozen sage websites since november, each time I’ve got to downgrade. Is this really so hard to fix?
Thank you. Note for everyone else, do not forget his second post below his first! The first 2 downgrades fixed the relative path issues and png and jpeg worked, but then svg would spit out Object object garble. Downgrading url-loader fixed that.