Error--Can't resolve 'fs' in (webpack 2配置CSS-loadeers)

前言,在之前有配置过webpack 2 中css loaders,但是怎么也不正确

报错:

1
2
3
4
5
6
7
ERROR in ./~/convert-source-map/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/ceshi/Desktop/webpack/node_modules/convert-source-map'
@ ./~/convert-source-map/index.js 2:9-22
@ ./~/css-loader/lib/css-base.js
@ ./~/css-loader!./app/style.css
@ ./app/style.css
@ ./app/main.js

解决方法,修改webpack的配置文件,增加一句代码

1
2
3
node: {
fs: 'empty'
},