您可能需要适当的加载程序来处理此文件

时间:2019-01-17 07:45:40

标签: reactjs react-native webpack babel

我已经安装了软件包rn-fetch-blob,并且抛出错误You may need an appropriate loader to handle this file。因此,我在Webpack中添加了ts-loader并在该软件包上尝试了path.resolve。我还尝试将@babel/preset-typescript添加到babel中,这也不起作用。有什么办法可以使它编译?

.babelrc文件

{
  "presets": [ "@babel/preset-typescript", "module:metro-react-native-babel-preset"]
}

webpack.config.js

  module: {
    rules: [
      {
        test: /\.js$/,
        include: [
          path.resolve(__dirname, "node_modules/rn-fetch-blob")
        ],
        loader: ["ts-loader","babel-loader"]
      },
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"]
      }
    ]
  },

0 个答案:

没有答案