Vue3 Application died in status LOADING_SOURCE_CODE: You need to export the functional lifecycles in

Vue3 Application died in status LOADING_SOURCE_CODE: You need to export the functional lifecycles in xxx entry

记录一下vue3qiankun踩坑

报错如标题

1、确认生命周期已经引入

确认生命周期已引入

2、确认配置是否正确

这里官方介绍比较简单,这样写的话 在webpack5.0会报错,验证不会通过
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output has an unknown property ‘jsonpFunction’. These properties are valid:
在这里插入图片描述
最后正确写法:

const { name } = require("./package.json");
const { defineConfig } = require("@vue/cli-service");

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 3001, // 指定端口
    headers: {
      "Access-Control-Allow-Origin": "*", // 配置跨域
      "Access-Control-Allow-Headers": "*",
      "Access-Control-Allow-Credentials": "true",
      "Access-Control-Allow-Methods": "*",
      "Cache-Control": "no-cache",
    },
    client: {
      overlay: {
        errors: true,
        warnings: false,
      }
    },
  },
  configureWebpack: {
    output: {
      library: `${name}-[name]`,
      libraryTarget: "umd",
      chunkLoadingGlobal: `webpackJsonp_${name}`,
    }
  },
});
  • 10
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值