无法从非 ecmascript 模块 pinia 和 Vue 2 导入命名导出 'computed'

can't import the named export 'computed' from non ecmascript module pinia and Vue 2

在我的 Vue 2 项目上安装 Pinia 后,将其导入到 main.js 文件中 我收到这个错误

Failed to compile.

./node_modules/pinia/dist/pinia.mjs 1147:44-52
Can't import the named export 'computed' from non EcmaScript module (only default export is available)

这个 Vue 配置应该可以解决问题

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

如本文所述Github issue