@cfmm/umi-plugins-ui-v2 0.0.24 → 0.0.25

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/dist/cjs/index.js CHANGED
@@ -124,6 +124,24 @@ var _default = exports.default = function _default(api) {
124
124
  api.writeTmpFile((0, _writeTmpFile.writeConstants)(api));
125
125
  api.writeTmpFile((0, _writeTmpFile.writeStatusConfig)(api));
126
126
  api.writeTmpFile(_writeTmpFile.writeTypes);
127
+
128
+ /**
129
+ * 在临时目录写入 package.json,声明 sideEffects 仅限样式文件。
130
+ *
131
+ * 作用:让业务方打包工具(webpack/vite)认定 plugin-cfmmUI 下的 JS 模块均为
132
+ * 无副作用的纯 ESM,从而开启 tree-shaking——业务未使用的组件/工具不会被打入
133
+ * 最终 bundle;同时 .css / .less 仍会按副作用处理,样式不会被误删。
134
+ *
135
+ * 不写此文件时,bundler 默认按 sideEffects: true 处理,barrel 中所有
136
+ * import 都会被保留,等同于全量打包。
137
+ */
138
+ api.writeTmpFile({
139
+ path: 'plugin-cfmmUI/package.json',
140
+ noPluginDir: true,
141
+ content: JSON.stringify({
142
+ sideEffects: ['**/*.css', '**/*.less']
143
+ }, null, 2)
144
+ });
127
145
  });
128
146
 
129
147
  // 添加运行时插件
package/dist/esm/index.js CHANGED
@@ -117,6 +117,24 @@ export default (function (api) {
117
117
  api.writeTmpFile(writeConstants(api));
118
118
  api.writeTmpFile(writeStatusConfig(api));
119
119
  api.writeTmpFile(writeTypes);
120
+
121
+ /**
122
+ * 在临时目录写入 package.json,声明 sideEffects 仅限样式文件。
123
+ *
124
+ * 作用:让业务方打包工具(webpack/vite)认定 plugin-cfmmUI 下的 JS 模块均为
125
+ * 无副作用的纯 ESM,从而开启 tree-shaking——业务未使用的组件/工具不会被打入
126
+ * 最终 bundle;同时 .css / .less 仍会按副作用处理,样式不会被误删。
127
+ *
128
+ * 不写此文件时,bundler 默认按 sideEffects: true 处理,barrel 中所有
129
+ * import 都会被保留,等同于全量打包。
130
+ */
131
+ api.writeTmpFile({
132
+ path: 'plugin-cfmmUI/package.json',
133
+ noPluginDir: true,
134
+ content: JSON.stringify({
135
+ sideEffects: ['**/*.css', '**/*.less']
136
+ }, null, 2)
137
+ });
120
138
  });
121
139
 
122
140
  // 添加运行时插件
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfmm/umi-plugins-ui-v2",
3
3
  "author": "ysj <411367308@qq.com>",
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
7
7
  "publishConfig": {