webpack can't find module if file named jsx

前端 未结 7 932
既然无缘
既然无缘 2020-11-28 06:43

As I write webpack.config.js like this

module.exports = {
  entry: \'./index.jsx\',
  output: {
    filename: \'bundle.js\'
  },
  module: {
    loaders: [{         


        
7条回答
  •  粉色の甜心
    2020-11-28 06:46

    As mentioned in the comments on the answer from @max, for webpack 4, I found that I needed to put this in one of the rules that were listed under module, like so:

    {
      module: {
        rules: [ 
          {
            test: /\.jsx?$/, 
            resolve: {
              extensions: [".js", ".jsx"]
            },
            include: ...
          }
        ]
      }
    }
    

提交回复
热议问题