2

我发现了很多关于此的问题,但没有一个答案有效..

我正在尝试将此中的节点模块中的字体导入 Create React 应用程序

我已经设法让它编译

@import './../node_modules/roboto-fontface/css/roboto/sass/roboto-fontface.scss';

但是,一旦我运行它,我就会得到

Module not found: You attempted to import ../../../fonts/roboto/Roboto-Black.eot
 which falls outside of the project src/ directory. Relative imports outside of
src/ are not supported. You can either move it inside src/, or add a symlink to
it from project's node_modules/.

我已经尝试过使用 ~、node_modules 和其他各种将其纳入项目的方法。有什么线索吗?

4

1 回答 1

2

我会在 src/ 中创建一个 assets/fonts/ 目录并将字体放在那里:)。试试看!

于 2018-07-11T03:43:19.517 回答