Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Font urls can't be resolved #50

Closed
nckrtl opened this issue Mar 16, 2021 · 5 comments
Closed

Font urls can't be resolved #50

nckrtl opened this issue Mar 16, 2021 · 5 comments

Comments

@nckrtl
Copy link

nckrtl commented Mar 16, 2021

Without jit it can resolve the urls in app.css with a preceding ../ just fine:

@layer base {
    @font-face {
        font-family: "Inter var";
        font-weight: 100 900;
        font-display: swap;
        font-style: normal;
        font-named-instance: "Regular";
        src: url("../fonts/Inter-roman.var.woff2") format("woff2");
    }
}

With jit enabled it results in error:

ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '___CSS_LOADER_URL_REPLACEMENT_0___' in '/Users/nckrtl/code/projects/laravel/nckrtl/resources/css'
    at finishWithoutResolve (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:293:18)
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:362:15
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:410:5
    at eval (eval at create (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:410:5
    at eval (eval at create (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:410:5
    at eval (eval at create (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/enhanced-resolve/lib/Resolver.js:410:5
    at processResult (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/webpack/lib/NormalModule.js:649:19)
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/webpack/lib/NormalModule.js:743:5
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/loader-runner/lib/LoaderRunner.js:399:11
    at /Users/nckrtl/code/projects/laravel/nckrtl/node_modules/loader-runner/lib/LoaderRunner.js:251:18
    at context.callback (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at Object.loader (/Users/nckrtl/code/projects/laravel/nckrtl/node_modules/css-loader/dist/index.js:154:5)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 2 errors

This is running in a basic Laravel project with all latest versions installed.

Edit: It seems to produce this error when the path IS actually correct. If path is incorrect it just gets ignored.

@nckrtl nckrtl changed the title font urls with a preceding ../ can't be resolved Font urls can't be resolved Mar 16, 2021
@nckrtl
Copy link
Author

nckrtl commented Mar 16, 2021

When defining the font url like:

src: url(/fonts/Inter-Roman-var.woff2) format("woff2");

It does work.

@nckrtl nckrtl closed this as completed Mar 16, 2021
@brentarcane
Copy link

Is it possible to make it work using relative font paths rather than absolute?

@nckrtl
Copy link
Author

nckrtl commented Mar 22, 2021

Hi Brent, not sure. I haven't been looking any further as the absolute path is working fine for me like this.

@brentarcane
Copy link

This was fixed in v0.1.7 👍

@nckrtl
Copy link
Author

nckrtl commented Mar 23, 2021

Ah good to know! Thanks

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

No branches or pull requests

2 participants