emp
emp copied to clipboard
请问,有这么奇怪的问题吗?使用emp远程调用的组件会丢失部分标签。

share 了吗
@ckken demo-one port:7001
const PluginBabelVue3 = require('@efox/plugin-babel-vue-3')
const {defineConfig} = require('@efox/emp')
module.exports=defineConfig(({mode,env})=>{
const port = 7001
const target = "es5"
return {
plugins: [PluginBabelVue3],
appEntry: 'main.ts',
server: {port: port},
html: {title: 'EMP One'},
build: {target},
empShare: {
name: 'one',
exposes: {
'./GloryAbout': './src/views/OneAboutView.vue',
'./HelloWorld':'./src/components/HelloWorld.vue'
},
shareLib: {
},
},
}
})
demo-main port:7000
const PluginBabelVue3 = require('@efox/plugin-babel-vue-3')
const {defineConfig} = require('@efox/emp')
module.exports=defineConfig(({mode,env})=>{
const port = 7000
const target = "es5"
return {
plugins: [PluginBabelVue3],
appEntry: 'main.ts',
server: {port: port},
html: {title: 'EMP main'},
build: {target},
empShare: {
name: 'main',
remotes:{
"@one":"one@http://localhost:7001/emp.js",
},
exposes: {
},
shareLib: {
},
},
}
})
使用HomeView.vue
<template>
<div class="home">
<h1>Home for Main App</h1>
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App from main"/>
</div>
</template>
<script lang="ts">
import { Options, Vue } from 'vue-class-component';
// import HelloWorld from '../components/HelloWorld.vue'; // @ is an alias to /src
// @ts-ignore
import HelloWorld from '@one/HelloWorld';
// import HelloWorld from '@one/GloryAbout'
@Options({
components: {
HelloWorld
},
})
export default class HomeView extends Vue {}
</script>
补充:他不是整个组件不显示,组件显示了,只是组件中少了一部分标签。另外我只需要将导出的组件中div的数量删除一部分,只留两三个,就能正常显示

把 vue share出来试试
我刚刚使用原生webpack模块联邦实验,也有同样的问题,只要是相同标签连续出现多次,就会出现丢失标签的情况。
把 vue share出来试试
试过并没有效果,问题根源应该不是这个
可以放在线code 出来看看