-
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 手机页面的项目使用的,没有路由,只是一个单纯的 |
getConfigFromEntryFile
选项开启后不能与浏览器环境变量兼容
感谢,我试试。 我们的场景有一部分属于类似于 ToB 的导购页面,每个页面都是独立的,没有路由,用 SPA 比较重。 |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
配置 MPA 后启动报错
在开启 MPA 的应用中使用到
![image](https://private-user-images.githubusercontent.com/5095093/300416606-9eb5e0a5-2399-4d74-b474-98e254a69323.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3MDI1NjMsIm5iZiI6MTcyMzcwMjI2MywicGF0aCI6Ii81MDk1MDkzLzMwMDQxNjYwNi05ZWI1ZTBhNS0yMzk5LTRkNzQtYjQ3NC05OGUyNTRhNjkzMjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTVUMDYxMTAzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzJiYTNjYmQ3NzQ0ZmE0MTZkYzg2YTNkMTE1ZGJmY2VhYWNkYzA2MmRlNmMyZGFlYzIzMWRmMDJiZGFkM2M0OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._g6WdPUXaugkWieQLsf6JmL1CVd_YiZ5aN456YJrM4o)
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: