Webpack 将CSS从节点_模块导入Create React应用程序
我在这方面发现了很多问题,但没有一个答案是有效的 我正在尝试从节点模块将字体从此导入到Create React应用程序中 我已经设法把它编译好了Webpack 将CSS从节点_模块导入Create React应用程序,webpack,sass,create-react-app,node-sass-chokidar,Webpack,Sass,Create React App,Node Sass Chokidar,我在这方面发现了很多问题,但没有一个答案是有效的 我正在尝试从节点模块将字体从此导入到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
@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_模块和各种其他方法将其引入到项目中。有什么线索吗 我会在src/中创建一个assets/fonts/目录,并将字体放在那里:)。试试看 你能解决这个问题吗?