Hi,
I just tried replacing gatsby-plugin-web-font-loader with your loader, as your blog neatly summated the problems with the former! My latest project is running on Gatsby v3 and I get a non-fatal error in develop-mode:
ERROR Failed to compile with 6 errors 17:39:23
⠀
error in ./node_modules/gatsby-omni-font-loader/components/AsyncFonts.tsx
⠀
Module parse failed: Unexpected token (7:23)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| import { Helmet } from "react-helmet"
|
export const AsyncFonts: React.FC<{ hrefs: string[] }> = ({ hrefs }) => {
| const links = []
|
⠀
error in ./node_modules/gatsby-omni-font-loader/components/FontListener.tsx
⠀
Module parse failed: The keyword 'interface' is reserved (7:0)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| import { hookOptions, useFontListener } from "../hooks"
|
interface Props {
| options: hookOptions
| }
⠀
error in ./node_modules/gatsby-omni-font-loader/utils/arrayCheck.ts
⠀
Module parse failed: Unexpected token (4:31)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| $RefreshSetup$(module.id);
|
export const arrayCheck = (arr?: unknown) =>
| arr && Array.isArray(arr) && Boolean(arr.length)
|
⠀
error in ./node_modules/gatsby-omni-font-loader/utils/getFontFiles.ts
⠀
Module parse failed: Unexpected token (4:37)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| $RefreshSetup$(module.id);
|
export const getFontFiles = (allFonts: { file: string }[]) =>
| allFonts.map(({ file }) => file)
|
⠀
error in ./node_modules/gatsby-omni-font-loader/utils/getFontNames.ts
⠀
Module parse failed: Unexpected token (4:37)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| $RefreshSetup$(module.id);
|
export const getFontNames = (allFonts: { name: string }[]) => {
| const fontNames = []
| allFonts.forEach(({ name }) =>
⠀
error in ./node_modules/gatsby-omni-font-loader/utils/kebabCase.ts
⠀
Module parse failed: Unexpected token (4:29)
File was processed with these loaders:
- ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| $RefreshSetup$(module.id);
|
export const kebabCase = (str: string) =>
| str
| .match(/[A-Z]{2,}(?=[A-Z][a-z0-9]|\b)|[A-Z]?[a-z0-9]|[A-Z]|[0-9]+/g)
⠀
The error on build is fatal and seems to include a conflict with netlify-cms:
ERROR #11321 PLUGIN
"gatsby-plugin-netlify-cms" threw an error while running the onCreateWebpackConfig lifecycle:
Module parse failed: Unexpected token (4:23)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See
https://webpack.js.org/concepts#loaders
| import { Helmet } from "react-helmet"
|
export const AsyncFonts: React.FC<{ hrefs: string[] }> = ({ hrefs }) => {
| const links = []
|
ModuleParseError: Module parse failed: Unexpected token (4:23)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See h
ttps://webpack.js.org/concepts#loaders
| import { Helmet } from "react-helmet"
|
export const AsyncFonts: React.FC<{ hrefs: string[] }> = ({ hrefs }) => {
| const links = []
|
My package.json dependencies are:
"dependencies": {
"@ccalamos/gatsby-source-googlemaps-static": "^3.1.1",
"babel-plugin-styled-components": "^1.12.0",
"gatsby": "^3.4.1",
"gatsby-background-image": "^1.5.3",
"gatsby-plugin-env-variables": "^2.1.0",
"gatsby-plugin-gatsby-cloud": "^2.4.1",
"gatsby-plugin-image": "^1.4.0",
"gatsby-plugin-manifest": "^3.4.0",
"gatsby-plugin-modal-routing-3": "^3.0.0",
"gatsby-plugin-netlify-cms": "^5.4.1",
"gatsby-plugin-offline": "^4.4.0",
"gatsby-plugin-react-helmet": "^4.4.0",
"gatsby-plugin-react-svg": "^3.0.1",
"gatsby-plugin-sharp": "^3.5.0",
"gatsby-plugin-smoothscroll": "^1.2.0",
"gatsby-plugin-styled-components": "^4.4.0",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-remark-copy-linked-files": "^4.2.1",
"gatsby-remark-images": "^5.2.1",
"gatsby-remark-relative-images": "^2.0.2",
"gatsby-source-filesystem": "^3.4.0",
"gatsby-transformer-remark": "^4.1.0",
"gatsby-transformer-sharp": "^3.4.0",
"gbimage-bridge": "^0.1.4",
"google-map-react": "^2.1.9",
"intersection-observer": "^0.12.0",
"netlify-cms-app": "^2.15.2",
"prop-types": "^15.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0",
"react-helmet": "^6.1.0",
"react-masonry-component": "^6.2.1",
"react-slick": "^0.28.1",
"react-slick-ios-fix": "^0.24.8",
"react-transition-group": "^4.4.1",
"remark": "^13.0.0",
"remark-html": "^13.0.1",
"request-animation-frame-polyfill": "^1.1.2",
"slick-carousel": "^1.8.1",
"styled-components": "^5.3.0",
"use-fit-text": "^2.4.0"
}
I'm node -v 16 ( I should really be on 14) don't know if this could cause the problem? Would be grateful for your insight?
Thanks