build: add remote-only mode lang package stub and replacement logic
add empty-lang-stub.js to stub lang package files in remote-only mode, add webpack plugin logic to replace lang files with stub to reduce bundle size
This commit is contained in:
15
common/js/empty-lang-stub.js
Normal file
15
common/js/empty-lang-stub.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// ============================================================
|
||||
// 空 lang 包占位
|
||||
//
|
||||
// 在 source === 'remote-only' 模式下, lang/ 目录下的所有 .js 会被
|
||||
// webpack.NormalModuleReplacementPlugin 替换为这个 stub.
|
||||
//
|
||||
// 设计要点:
|
||||
// - 导出 default 对象, 结构与真实 lang 包一致: { lang: {...} }
|
||||
// - lang 字段是空对象, 让 lang() 函数 fallback 路径不报错
|
||||
// - 不导出 named export, 避免 tree-shaking 把整个 stub 干掉
|
||||
// ============================================================
|
||||
|
||||
export default {
|
||||
lang: {}
|
||||
};
|
||||
Reference in New Issue
Block a user