export 'default' (imported as 'mod') was not found in '-!../../.........(省略)

1.检查下载vue/cli-plugin-typescript

2.vue.config.js文件中的webpack配置:

module.exports = {
  baseUrl: IS_PROD ? '' : '/', //publicPath
  productionSourceMap: false,
  outputDir: 'build',
  configureWebpack: config => {
    config.externals = {
      'AMap': 'AMap',
      'Loca': 'Loca',
      'AMapUI': 'AMapUI',
      'WxLogin': 'WxLogin',
    }
      config.plugins = [...config.plugins, ...plugins]
    }
  },
  chainWebpack: config => {
    // config.resolve.alias.set('img', resolve('src/assets/img'))
    config.resolve.alias.set('@', resolve('src'))
    config.module.rule('ts').use('babel-loader')  /*这里*/
  },

3.注入规则(可自行选择其一即可)

config.rule('ts')
config.rule('ts').use('ts-loader')
config.rule('ts').use('babel-loader')(一起使用时@vue/cli-plugin-babel)
config.rule('ts').use('cache-loader')
config.plugin('fork-ts-checker')

  

posted @ 2022-09-14 15:59  妄欢  阅读(1417)  评论(0编辑  收藏  举报