Skip to content

Failing to run in Lerna/Yarn Workspaces powered app with custom fonts in CSS #2193

@seniorquico

Description

@seniorquico

I'm having trouble loading custom fonts in CSS in a new app created using CRA.

I added the "mdi" package (for the Material Design Icons font) and added "@import '~mdi/css/materialdesignicons.css';" in the "index.css" file. When I run/build using CRA, everything works fine. However, when I run with Storybook, I get the following error (repeated multiple times for each of the font files... ttf, woff, woff2, svg):

ERROR in ...node_modules/mdi/fonts/materialdesignicons-webfont.ttf?v=2.0.46
Module parse failed: Unexpected character ' ' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ...node_modules/@storybook/react/node_modules/css-loader?{"importLoaders":1}!...node_modules/@storybook/react/node_modules/postcss-loader/lib?{"ident":"postcss","plugins":[null,null]}!...node_modules/mdi/css/materialdesignicons.css 6:512-572
 @ ...node_modules/@storybook/react/node_modules/css-loader?{"importLoaders":1}!...node_modules/@storybook/react/node_modules/postcss-loader/lib?{"ident":"postcss"}!./src/index.css
 @ ./src/index.css
 @ ./.storybook/config.js
 @ multi ...node_modules/@storybook/react/dist/server/config/polyfills.js ...node_modules/@storybook/react/dist/server/config/globals.js ...node_modules/webpack-hot-middleware/client.js?reload=true ./.storybook/config.js

I don't have any custom webpack configs, I'm just using the defaults from CRA. Is anyone else having problems loading custom fonts? Could this be something unique to Material Design Icons?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions