Uncaught TypeError: fs.readFileSync is not a function

后端 未结 4 651
孤城傲影
孤城傲影 2020-11-30 15:28

I am trying to get webpack and mapbox-gl work together within Meteor system. I have look everywhere about the error mentioned above but none works. Here is my webpack setup

4条回答
  •  甜味超标
    2020-11-30 15:44

    I had a similar issue. Try this:

    Identify which module is throwing the fs.readFileSync error. For me it was mime which is a dependency of url-loader.

    I replaced it with file-loader which doesn't depend on mime, and hence not the fs. Ensure to uninstall url-loader as it will still throw the error!

    Then update your webpack.conf with:

    { test: /\.(ttf|eot|svg|jpg|gif|png|woff|woff2)$/, loader: 'file-loader' }

    Hope that helps!

提交回复
热议问题