-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[求答疑] 子应用入口文件 main.js 所在的 script 标签带有 type=module,fetch 获取该资源后执行报错 #1024
Comments
sufengyong
changed the title
[Bug] 子应用入口文件 main.js 所在的 script 标签带有 type=module,fetch 获取该资源后执行报错
[求答疑] 子应用入口文件 main.js 所在的 script 标签带有 type=module,fetch 获取该资源后执行报错
Oct 26, 2020
问楼主个问题,如何在vite中向外暴露jsonpFunction 配置微应用的打包工具
上面的配置文字 在vite.config.js怎么写,感谢🙏 |
找到了 vite 和 single-spa的结合 |
这个问题解决了吗 |
花了两天的时间,勉强算是跑通了,给一个我的解决方案:
{
...
rollupInputOptions: {
input: 'src/main.js',
preserveEntrySignatures: true
},
rollupOutputOptions: {
output: {
dir: 'dist',
assetFileNames: '_assets/[name].[hash][extname]',
entryFileNames: '_assets/[name].[hash].js',
format: 'umd',
name: '自定义'
}
}
}
总的来说因为以后每次打包都要手动改一次 |
新版的 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happens?
开发环境下,使用 vite(vite 不是 webpack) 初始化的 vue3 子项目时,子项目的 html 的入口文件的 script 标签上有 type=module,而乾坤内部直接取用了 script 上的 src 的值通过 fetch 获取后 eval 直接执行而忽略了 script 标签上带有的 type=module ,导致执行失败报错
Cannot use import statement outside a module
error occurs while executing normal script <script type="module">import "/vite/client"</script>
error occurs while executing entry script //localhost:3000/main.js
最小可复现仓库
公司内网项目无法对外提供,使用 vite 直接初始化 vue3 项目作为子项目即可浮现
复现步骤,错误日志以及相关配置
使用 vite 初始化项目后直接做为子项目,配置好主应用的路由指向子应用,运行即可出现
相关环境信息
2.2.2
chrome85.0.4183.102(正式版本) (64 位)
win10
The text was updated successfully, but these errors were encountered: