Skip to content
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

discuss: magic string for publicPath #1358

Closed
PeachScript opened this issue Jul 2, 2024 · 2 comments
Closed

discuss: magic string for publicPath #1358

PeachScript opened this issue Jul 2, 2024 · 2 comments
Assignees

Comments

@PeachScript
Copy link
Member

目前的逻辑是:

  1. 默认值为 '/'
  2. 配置 '' 也会兜底到默认值
  3. 'runtime' 特殊值开启运行时 publicPath

存在的问题是:

  1. 无法配置成 '',但有内部框架里默认值是 ''
  2. 设置 'runtime' 就无法设置初始值了,但运行时动态修改和初始值其实是两个场景

Webpack 的做法是:

  1. 允许设置为 '',相对路当前 url 加载
  2. 允许设置为 'auto',基于 document.currentScript 相对于脚本路径加载
  3. 没有 'runtime',而是提供 __webpack_public_path__ 全局变量作为修改入口

讨论点:

  1. 是否允许 ''
  2. 是否把 'runtime' 上提到框架自己实现,或者单独变成 runtimePublicPath 的配置
  3. 是否支持 'auto',目前看优先级倒是不高
@whyer11
Copy link
Contributor

whyer11 commented Jul 2, 2024

我的观点:

  1. 不允许设置''
  2. runtime的配置和当前的publicPath配置指代不明,建议分开
  3. auto配置低优先级

@sorrycc
Copy link
Member

sorrycc commented Jan 14, 2025

I'll close it and reopen it if necessary.

@sorrycc sorrycc closed this as completed Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants