2020-05-19

webpack打包过程中遇到的错误

运行cd app && npm run dev
出现如下错误:
ERROR in ./src/index.js
Module not found: Error: Can't resolve 'truffle-contract' in '/ubuntu-share/ubuntu1/ebay_dapp/app/src'
@ ./src/index.js 6:0-54 9:21-29

解决如下:
sudo npm install truffle-contract

ERROR in ./stylesheets/app.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

.col-margin-bottom-1 {
| margin-bottom: 1em;
| }
@ ./src/index.js 2:0-32
? ?wdm?: Failed to compile.

解决如下:
在webpack.config.js文件中添加如下内容:

  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ['style-loader', 'css-loader'],
      }
    ]
  },

问题解决!

你可能感兴趣的:(2020-05-19)