From 7bd093634999c756c5335df3ff07b45aa8f374ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Sat, 22 Jan 2022 10:05:03 +0800 Subject: [PATCH] refactor(build): switch to @vitejs/plugin-vue (#5504) --- build/full-bundle.ts | 9 +++--- build/modules.ts | 7 ++-- package.json | 2 +- packages/element-plus/package.json | 4 +-- pnpm-lock.yaml | 52 +++++++----------------------- 5 files changed, 23 insertions(+), 51 deletions(-) diff --git a/build/full-bundle.ts b/build/full-bundle.ts index 6c62326ebb..14ac354d82 100644 --- a/build/full-bundle.ts +++ b/build/full-bundle.ts @@ -2,7 +2,7 @@ import path from 'path' import { nodeResolve } from '@rollup/plugin-node-resolve' import { rollup } from 'rollup' import commonjs from '@rollup/plugin-commonjs' -import vue from 'rollup-plugin-vue' +import vue from '@vitejs/plugin-vue' import esbuild from 'rollup-plugin-esbuild' import replace from '@rollup/plugin-replace' import filesize from 'rollup-plugin-filesize' @@ -29,13 +29,12 @@ async function buildFullEntry(minify: boolean) { input: path.resolve(epRoot, 'index.ts'), plugins: [ ElementPlusAlias(), + vue({ + isProduction: true, + }), nodeResolve({ extensions: ['.mjs', '.js', '.json', '.ts'], }), - vue({ - target: 'browser', - exposeFilename: false, - }), commonjs(), esbuild({ minify, diff --git a/build/modules.ts b/build/modules.ts index a855ca3a4c..d1e5690af0 100644 --- a/build/modules.ts +++ b/build/modules.ts @@ -1,5 +1,5 @@ import { rollup } from 'rollup' -import vue from 'rollup-plugin-vue' +import vue from '@vitejs/plugin-vue' import css from 'rollup-plugin-css-only' import { nodeResolve } from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' @@ -27,7 +27,9 @@ export const buildModules = async () => { plugins: [ ElementPlusAlias(), css(), - vue({ target: 'browser' }), + vue({ + isProduction: false, + }), nodeResolve({ extensions: ['.mjs', '.js', '.json', '.ts'], }), @@ -39,7 +41,6 @@ export const buildModules = async () => { filesize({ reporter }), ], external: await generateExternal({ full: false }), - treeshake: false, }) await writeBundles( bundle, diff --git a/package.json b/package.json index 0890bfd959..aea090c071 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "@types/sass": "1.43.1", "@typescript-eslint/eslint-plugin": "5.10.0", "@typescript-eslint/parser": "5.10.0", + "@vitejs/plugin-vue": "2.1.0", "@vue/test-utils": "2.0.0-rc.16", "chalk": "4.1.2", "components-helper": "1.0.5", @@ -115,7 +116,6 @@ "rollup-plugin-css-only": "3.1.0", "rollup-plugin-esbuild": "4.8.2", "rollup-plugin-filesize": "9.1.2", - "rollup-plugin-vue": "6.0.0", "sass": "1.49.0", "sucrase": "3.20.3", "ts-jest": "26.5.6", diff --git a/packages/element-plus/package.json b/packages/element-plus/package.json index 0ce80fe1e8..30d883391c 100644 --- a/packages/element-plus/package.json +++ b/packages/element-plus/package.json @@ -34,8 +34,8 @@ "dist/*", "theme-chalk/*.css", "theme-chalk/src/*.scss", - "lib/components/**/*", - "es/components/**/*" + "es/components/*/style/*", + "lib/components/*/style/*" ], "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3676852339..bf5217d03b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,6 +31,7 @@ importers: '@types/sass': 1.43.1 '@typescript-eslint/eslint-plugin': 5.10.0 '@typescript-eslint/parser': 5.10.0 + '@vitejs/plugin-vue': 2.1.0 '@vue/test-utils': 2.0.0-rc.16 '@vueuse/core': ^7.5.4 async-validator: ^4.0.7 @@ -65,7 +66,6 @@ importers: rollup-plugin-css-only: 3.1.0 rollup-plugin-esbuild: 4.8.2 rollup-plugin-filesize: 9.1.2 - rollup-plugin-vue: 6.0.0 sass: 1.49.0 sucrase: 3.20.3 ts-jest: 26.5.6 @@ -110,6 +110,7 @@ importers: '@types/sass': 1.43.1 '@typescript-eslint/eslint-plugin': 5.10.0_706fb07ce74b1db611f19a02ad2ce784 '@typescript-eslint/parser': 5.10.0_eslint@8.7.0+typescript@4.5.5 + '@vitejs/plugin-vue': 2.1.0_vue@3.2.27 '@vue/test-utils': 2.0.0-rc.16_vue@3.2.27 chalk: 4.1.2 components-helper: 1.0.5 @@ -138,7 +139,6 @@ importers: rollup-plugin-css-only: 3.1.0_rollup@2.65.0 rollup-plugin-esbuild: 4.8.2_esbuild@0.14.11+rollup@2.65.0 rollup-plugin-filesize: 9.1.2 - rollup-plugin-vue: 6.0.0 sass: 1.49.0 sucrase: 3.20.3 ts-jest: 26.5.6_jest@26.6.3+typescript@4.5.5 @@ -2150,6 +2150,16 @@ packages: vue: 3.2.27 dev: true + /@vitejs/plugin-vue/2.1.0_vue@3.2.27: + resolution: {integrity: sha512-AZ78WxvFMYd8JmM/GBV6a6SGGTU0GgN/0/4T+FnMMsLzFEzTeAUwuraapy50ifHZsC+G5SvWs86bvaCPTneFlA==} + engines: {node: '>=12.0.0'} + peerDependencies: + vite: ^2.5.10 + vue: ^3.2.25 + dependencies: + vue: 3.2.27 + dev: true + /@volar/code-gen/0.30.6: resolution: {integrity: sha512-odkXN91QCS/KRKPk4eUQp7jkN0PuYLwDuJZwGiDDJrZWUCCSdEvSj7e+Cjk7Q7doX0G9WAF88BL7ozcjzrtiKw==} dependencies: @@ -3965,18 +3975,6 @@ packages: ms: 2.1.3 dev: true - /debug/4.3.2: - resolution: {integrity: sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - dev: true - /debug/4.3.3: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} engines: {node: '>=6.0'} @@ -4976,10 +4974,6 @@ packages: engines: {node: '>=4.0'} dev: true - /estree-walker/0.6.1: - resolution: {integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==} - dev: true - /estree-walker/1.0.1: resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} dev: true @@ -5967,10 +5961,6 @@ packages: function-bind: 1.1.1 dev: true - /hash-sum/2.0.0: - resolution: {integrity: sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==} - dev: true - /homedir-polyfill/1.0.3: resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} engines: {node: '>=0.10.0'} @@ -9365,24 +9355,6 @@ packages: - supports-color dev: true - /rollup-plugin-vue/6.0.0: - resolution: {integrity: sha512-oVvUd84d5u73M2HYM3XsMDLtZRIA/tw2U0dmHlXU2UWP5JARYHzh/U9vcxaN/x/9MrepY7VH3pHFeOhrWpxs/Q==} - peerDependencies: - '@vue/compiler-sfc': '*' - dependencies: - debug: 4.3.2 - hash-sum: 2.0.0 - rollup-pluginutils: 2.8.2 - transitivePeerDependencies: - - supports-color - dev: true - - /rollup-pluginutils/2.8.2: - resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} - dependencies: - estree-walker: 0.6.1 - dev: true - /rollup/2.64.0: resolution: {integrity: sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==} engines: {node: '>=10.0.0'}