简体   繁体   English

当我执行npm start时反应CSS加载器问题

[英]React Css loader issue when I execute npm start

I am facing issue when I execute npm start command.I am using ubuntu and node 4.2.2 version. 我在执行npm start命令时遇到问题。我正在使用ubuntu和node 4.2.2版本。

ERROR in ./~/css-loader!./~/autoprefixer-loader?browsers=last 3 versions!./~/sass-loader?outputStyle=expanded&includePaths[]=path/node_modules!./src/styles/index.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../../assets/fonts/Roboto/roboto-light.eot in path/src/styles ./~/css-loader!./~/autoprefixer-loader?browsers=最近3个版本中有错误!./〜/ sass-loader?outputStyle = expanded&includePaths [] = path / node_modules!./ src / styles / index。找不到scss模块:错误:无法解析path / src / styles中的“文件”或“目录” ../../assets/fonts/Roboto/roboto-light.eot

My project file structure is 我的项目文件结构是

webclient/
   assets/
      fonts/
        Material Icons/
        Roboto/
        RobotoDraft/

Install file-loader then test for 安装文件加载器,然后测试

  test: /.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,

  use: [
          {
            loader: 'file-loader',
            options: {
              outputPath: 'fonts/',
              name: '[name][hash].[ext]',
          },
        },
      ],

Using file-loader, u can save fonts in build directory 使用文件加载器,您可以将字体保存在构建目录中

You can also use url-loader, so that u can inline the fonts in your build js file. 您还可以使用url-loader,以便您可以内嵌构建js文件中的字体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM