webpack打包压缩后,报错,怎么解决?

webpack打包后,在打开html页面,就报了如下的错误

https://img1.mukewang.com/5bee241c0001ab8111420144.jpg

.babelrc的配置如下:

{

  "presets": [

    "react",

    "es2015",

    "stage-0"

  ],

  "env": {

    "development": {

      "plugins": [

        [

          "react-transform",

          {

            "transforms": [

              {

                "transform": "react-transform-hmr",

                "imports": [

                  "react"

                ],

                "locals": [

                  "module"

                ]

              }

            ]

          }

        ]

      ]

    }

  }

}

报错:

locals[0] does not appear to be a `module` object with Hot Module replacement API enabled. You should disable react-transform-hmr in production by using `env` section in Babel configuration.


胡子哥哥
浏览 823回答 1
1回答

叮当猫咪

.bablerc 不需要配置env把,直接删除试试看呢
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript