This issue is similar to this one.
I know this issue has been brought up multiple times but I am banging my head against the wall here trying to come up with a solution. I am not much of a Webpack expert, so I imagine that’s the source of my ignorance but help would be appreciated. I have a sage install that have been working on for quite a few months with few issues and I am trying to hook up local fonts. I am having issues with the relative paths, not a build time error but the final URL outputs are incorrect.
In my _fonts.scss file:
@font-face {
font-family: 'Raleway';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('../fonts/Raleway-Regular.ttf') format('truetype');
}
In chrome the outputed error:
Failed to decode downloaded font: https://site.test/wp-content/themes/theme/dist/styles/wp-content/themes/theme/dist/fonts/Raleway-Regular.ttf
As you can see, the URL is doubling. Here is my config.json:
"publicPath": "wp-content/themes/theme", "devUrl": "https://site.test", "proxyUrl": "https://localhost:3000",
And my dependencies in package.json:
"devDependencies": {
"autoprefixer": "~8.2.0",
"browser-sync": "~2.24.7",
"browsersync-webpack-plugin": "^0.6.0",
"bs-html-injector": "~3.0",
"buble-loader": "^0.4.1",
"cache-loader": "~1.2.5",
"clean-webpack-plugin": "^0.1.18",
"copy-globs-webpack-plugin": "^0.2.0",
"css-loader": "^0.28.9",
"cssnano": "~4.0.5",
"eslint": "~4.19.1",
"eslint-loader": "~1.9",
"eslint-plugin-import": "~2.14.0",
"extract-text-webpack-plugin": "~3.0.2",
"file-loader": "^1.1.6",
"friendly-errors-webpack-plugin": "^1.6.1",
"glob-all": "^3.2.1",
"imagemin-mozjpeg": "~7.0.0",
"imagemin-webpack-plugin": "~2.2.0",
"import-glob": "~1.5",
"node-sass": "~4.9.4",
"postcss-loader": "~2.1.0",
"postcss-safe-parser": "~3.0",
"purgecss-webpack-plugin": "0.23.0",
"resolve-url-loader": "~2.3.1",
"rimraf": "~2.6",
"sass-loader": "~6.0",
"style-loader": "^0.22.1",
"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"tailwindcss": "1.9.6",
"uglifyjs-webpack-plugin": "^1.3.0",
"url-loader": "^0.6.2",
"webpack": "3.12.0",
"webpack-assets-manifest": "^1.0.0",
"webpack-dev-middleware": "~2.0.4",
"webpack-hot-middleware": "~2.22.3",
"webpack-merge": "~4.1.4",
"yargs": "~11.0.0"
},
I have the correct versions of url-loader and resolve-url-loader that have seemed to cause issues to others in the past. Any ideas?
I am using node v10.21.0, Sage 9.0.9