From 4eea235fba5fe824362bd736da2bae452d2645df Mon Sep 17 00:00:00 2001 From: eiinu <44915689+eiinu@users.noreply.github.com> Date: Mon, 6 Feb 2023 19:50:42 +0800 Subject: [PATCH] fix: change sideEffects & default export (#2094) --- jd/generate-nutui.cjs | 4 ++-- jd/generate-unplugin-deps.cjs | 17 +++++------------ publish/nutui-taro/package.json | 7 +++---- publish/nutui/package.json | 6 ++---- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/jd/generate-nutui.cjs b/jd/generate-nutui.cjs index 2330195451..29dfc06d83 100644 --- a/jd/generate-nutui.cjs +++ b/jd/generate-nutui.cjs @@ -35,7 +35,7 @@ let fileStrBuild = `${importStr} ${installFunction} const version = '${packageConfig.version}'; export { install, version, Locale, ${packages.join(',')}, ${methods.join(',')}}; -export default { install, version, Locale};`; +export default { install, version};`; fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.build.ts'), fileStrBuild, 'utf8', (error) => { // logger.success(`${package_config_path} 文件写入成功`); @@ -46,7 +46,7 @@ ${installFunction} ${importScssStr} export const testComponents = { ${packages.join(',')}}; export { install, Locale, ${packages.join(',')}, ${methods.join(',')} }; -export default { install, version:'${packageConfig.version}', Locale};`; +export default { install, version:'${packageConfig.version}'};`; fs.outputFile(path.resolve(__dirname, '../src/packages/nutui.vue.ts'), fileStrDev, 'utf8', (error) => { // logger.success(`${package_config_path} 文件写入成功`); }); diff --git a/jd/generate-unplugin-deps.cjs b/jd/generate-unplugin-deps.cjs index 1bd4120aed..578c0a3b3e 100644 --- a/jd/generate-unplugin-deps.cjs +++ b/jd/generate-unplugin-deps.cjs @@ -48,8 +48,8 @@ export { ${element.name} };`; }); }); outputFileEntry += components.map(name => `import { ${name} } from "./packages/${name.toLowerCase()}/index.mjs";`).join('\n'); -outputFileEntry += `\nimport { Locale } from "./packages/locale/lang"; -function install(app) { +outputFileEntry += `\nexport { Locale } from "./packages/locale/lang"; +export function install(app) { const packages = [${components.join(',')}]; packages.forEach((item) => { if (item.install) { @@ -59,17 +59,10 @@ function install(app) { } }); } -const version = '${packageConfig.version}'; -var stdin_default = { +export const version = '${packageConfig.version}'; +export default { install, - version, - Locale -}; -export { - stdin_default as default, - install, - version, - Locale + version };`; tasks.push( diff --git a/publish/nutui-taro/package.json b/publish/nutui-taro/package.json index 89847e7ceb..e8d595879b 100644 --- a/publish/nutui-taro/package.json +++ b/publish/nutui-taro/package.json @@ -7,10 +7,9 @@ "style": "dist/style.css", "typings": "dist/types/index.d.ts", "sideEffects": [ - "dist/packages/**/*", - "dist/packages/locale/lang/*", - "dist/styles/**", - "dist/style.css" + "dist/packages/**/style.mjs", + "*.scss", + "*.css" ], "web-types": "dist/smartips/web-types.json", "keywords": [ diff --git a/publish/nutui/package.json b/publish/nutui/package.json index 04df4e934e..db6455eda8 100644 --- a/publish/nutui/package.json +++ b/publish/nutui/package.json @@ -7,11 +7,9 @@ "style": "dist/style.css", "typings": "dist/types/index.d.ts", "sideEffects": [ - "dist/packages/**/*", "dist/packages/**/style.mjs", - "dist/packages/locale/lang/*", - "dist/styles/**", - "dist/style.css" + "*.scss", + "*.css" ], "web-types": "dist/smartips/web-types.json", "keywords": [