'import' and 'export' may only appear at the top level

后端 未结 15 1587
耶瑟儿~
耶瑟儿~ 2020-12-08 18:00

I\'m using webpack with vuejs. Webpack does its thing, but when I look at the outputted app.js file, it gives me this error.

\'import\' and \'export\

15条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 18:47

    For me, this was caused by a reference to module in a hot module replacement implementation:

    constructor() {
      if (module && module.hot) {
        module.hot.status(status => {
          if (status === 'dispose') {
            this.webSocket.close();
          }
        });
      }
    }
    

提交回复
热议问题