-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Bug] MPA getConfigFromEntryFile
选项开启后不能与浏览器环境变量兼容
#12103
Comments
这是因为这个 example 开了 mpa 的一个实验性选项 如果要用 mpa ,就把这个选项去掉吧,然后每页的配置写到 你可能并不需要 mpa 功能,这个是给蚂蚁少量 h5 手机页面的项目使用的,没有路由,只是一个单纯的 |
fz6m
changed the title
[Bug] MPA 应用启动报错 ReferenceError: window is not defined
[Bug] MPA Jan 30, 2024
getConfigFromEntryFile
选项开启后不能与浏览器环境变量兼容
感谢,我试试。 我们的场景有一部分属于类似于 ToB 的导购页面,每个页面都是独立的,没有路由,用 SPA 比较重。 |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
配置 MPA 后启动报错
在开启 MPA 的应用中使用到
window
变量会报错复现路径
基于 Umi 官方的 MPA 示例,只加了一行代码,即可复现。
const isPre = /pre-|local/.test(window.location.host);
mpaTest.zip
npm i
安装依赖npm start
启动就会出现
ReferenceError: window is not defined
错误上下文
The text was updated successfully, but these errors were encountered: