web-extend-plugin-vue2 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  ## 包形态与兼容性
6
6
 
7
7
  - **发布入口为预构建的 `dist/`(CJS + ESM)**,不含 `.vue` 源码、**运行时无 `import.meta` 语法**,避免 Vue CLI / Webpack 4 宿主再配 `transpileDependencies`、Babel `import.meta` 补丁等与版本强耦合的改动。包内存在模块顶层初始化(如 `registries` 的 `Vue.observable`),**不**声明 `sideEffects: false`,以免宿主打包器误裁剪。
8
+ - **Webpack 4 / Vue CLI 4**:`package.json` **不**再声明 `module` 字段,默认解析 **`main` → `dist/index.cjs`**,由 Webpack 正常注入 `require`,避免误选 `index.mjs` 后在浏览器中出现 `require is not defined`。支持 `package.json` **`exports`** 的 Webpack 5、Vite、Rollup 等仍通过 **`import` 条件**使用 `dist/index.mjs`。
8
9
  - **peer**:`vue` `>=2.6.14 <3`,`vue-router` `>=3.2.0 <4`(与 2.6 / 2.7 主流栈对齐,减轻版本地狱)。
9
10
  - **Vite 宿主**:通过 `env: import.meta.env` 或 `setWebExtendPluginEnv(import.meta.env)` 注入环境,即可读取文档中的 `VITE_*` 键。
10
11
 
@@ -126,6 +127,14 @@ disposeWebPlugin('your.plugin.id')
126
127
 
127
128
  Vue Router 3 无公开 `removeRoute`,动态路由卸载后可能需整页刷新。
128
129
 
130
+ ## 版本纪要
131
+
132
+ ### 0.2.1
133
+
134
+ - **Webpack 4 / Vue CLI**:去掉 `package.json` 的 `module` 字段,默认走 **`main`(CJS)**,避免误解析 `index.mjs` 导致浏览器端 `require is not defined`。
135
+ - **`exports`**:补充 `default` 指向 CJS,便于仅部分实现 `exports` 条件的工具链兜底。
136
+ - **语法兼容**:源码避免 `??` 等 Webpack 4 解析 `node_modules` 内 CJS 时可能不支持的语法,便于无 `transpileDependencies` 开箱接入。
137
+
129
138
  ## 仓库与协议
130
139
 
131
140
  - 源码:[extend-plugin-framework / web-extend-plugin-vue2](https://github.com/xtemplus/extend-plugin-framework/tree/master/web-extend-plugin-vue2)