webpack can't find module if file named jsx

前端 未结 7 967
既然无缘
既然无缘 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 07:02

    In the interest of readability and copy-paste coding. Here is the webpack 4 answer from mr rogers comment in this thread.

    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          exclude: /node_modules/,
          resolve: {
            extensions: [".js", ".jsx"]
          },
          use: {
            loader: "babel-loader"
          }
        },
      ]
    }
    

提交回复
热议问题