我发现了很多与此有关的问题,但是没有一个答案有效。
我正在尝试从package的节点模块中导入字体到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和其他各种方法将其放入项目。有什么线索吗?
答案 0 :(得分:2)
我将在src /中创建一个assets / fonts /目录,并将字体放在:)。试试看!