vue 报错 Can’t import the named export ‘XXXX’ from

Can’t import the named export ‘XXXXX’ from non EcmaScript module
error in ./node_modules/XXXXX/XXXX.mjs
Can’t import the named export ‘XXXXX’ from non EcmaScript module
error in ./node_modules/XXXXX/XXXX.mjs

编辑我的vue.config.js文件

// vue.config.js
module.exports = {
    
    
  configureWebpack: {
    
    
    module: {
    
    
      rules: [
        {
    
    
          test: /\.mjs$/,
          include: /node_modules/,
          type: "javascript/auto"
        }
      ] 
    }
  }
}

保存后,再重新跑一下试试。还不行,可以把node_modules跟package-lock.json都删除,重新npm install,再运行。

猜你喜欢

转载自blog.csdn.net/god_sword_/article/details/130522523