From e5b1e17b266868ad6637cb6e29f29625b70d1591 Mon Sep 17 00:00:00 2001 From: winixt Date: Wed, 15 Dec 2021 18:08:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=9A=E4=B9=89=20config=20?= =?UTF-8?q?=E4=B8=8D=E5=85=BC=E5=AE=B9=20vue-loader=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-icon/src/optimizeSvg.js | 9 +--- packages/fes-plugin-windicss/package.json | 5 ++- packages/fes-plugin-windicss/src/index.js | 11 ++++- packages/fes-plugin-windicss/src/pitcher.js | 13 ++++++ packages/fes-template-h5/package.json | 1 + yarn.lock | 48 +++++++++++++-------- 6 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 packages/fes-plugin-windicss/src/pitcher.js diff --git a/packages/fes-plugin-icon/src/optimizeSvg.js b/packages/fes-plugin-icon/src/optimizeSvg.js index a945e31b..545a6885 100644 --- a/packages/fes-plugin-icon/src/optimizeSvg.js +++ b/packages/fes-plugin-icon/src/optimizeSvg.js @@ -4,14 +4,9 @@ import { optimize } from 'svgo'; const presetDefault = [ { - name: 'preset-default', - params: { - overrides: { - sortAttrs: true, - removeDimensions: true - } - } + name: 'preset-default' }, + 'cleanupListOfValues', { name: 'removeAttrs', params: { diff --git a/packages/fes-plugin-windicss/package.json b/packages/fes-plugin-windicss/package.json index 6077f278..9017555f 100644 --- a/packages/fes-plugin-windicss/package.json +++ b/packages/fes-plugin-windicss/package.json @@ -31,6 +31,7 @@ "vue": "^3.0.5" }, "dependencies": { - "windicss-webpack-plugin": "^1.5.8" + "qs": "^6.10.2", + "windicss-webpack-plugin": "^1.6.0" } -} +} \ No newline at end of file diff --git a/packages/fes-plugin-windicss/src/index.js b/packages/fes-plugin-windicss/src/index.js index 2625fddb..e522b43b 100644 --- a/packages/fes-plugin-windicss/src/index.js +++ b/packages/fes-plugin-windicss/src/index.js @@ -1,7 +1,7 @@ import WindiCSSWebpackPlugin from 'windicss-webpack-plugin'; import { resolve } from 'path'; - +import qs from 'qs'; export default (api) => { api.describe({ @@ -23,6 +23,15 @@ export default (api) => { ...api.config.windicss } ]); + memo.module + .rule('vue-custom') + .resourceQuery((query) => { + if (!query) { + return false; + } + const parsed = qs.parse(query.slice(1)); + return parsed.vue != null; + }).use('vue-custom-loader').loader(require.resolve('./pitcher')); return memo; }); }; diff --git a/packages/fes-plugin-windicss/src/pitcher.js b/packages/fes-plugin-windicss/src/pitcher.js new file mode 100644 index 00000000..1f944b43 --- /dev/null +++ b/packages/fes-plugin-windicss/src/pitcher.js @@ -0,0 +1,13 @@ +import qs from 'qs'; + +const pitcher = code => code; + +export const pitch = function () { + const context = this; + const query = qs.parse(context.resourceQuery.slice(1)); + if (query.type === 'custom' && query.blockType === 'config') { + return ''; + } +}; + +export default pitcher; diff --git a/packages/fes-template-h5/package.json b/packages/fes-template-h5/package.json index 110d98f4..180328e0 100644 --- a/packages/fes-template-h5/package.json +++ b/packages/fes-template-h5/package.json @@ -48,6 +48,7 @@ "@fesjs/fes": "^2.0.0", "@fesjs/plugin-icon": "^2.0.0", "@fesjs/plugin-request": "^2.0.0", + "@fesjs/plugin-windicss": "^2.0.0", "vue": "3.2.2" }, "private": true diff --git a/yarn.lock b/yarn.lock index 40447ae8..277183b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3486,23 +3486,23 @@ "@webassemblyjs/ast" "1.11.1" "@xtuc/long" "4.2.2" -"@windicss/config@1.5.1": - version "1.5.1" - resolved "https://registry.npmjs.org/@windicss/config/-/config-1.5.1.tgz#e3fdaddfc553442c85f67f2e9290ef46ce87b3a1" - integrity sha512-nWNgvvJj9RcYhLcqwju/Z8FfaHRjyWHDYS3IgY7lWUM+vWTLFuKqhavKfC1589kdYjiO9JeX07Vg+YzfcxP0Yw== +"@windicss/config@1.5.4": + version "1.5.4" + resolved "https://registry.npmjs.org/@windicss/config/-/config-1.5.4.tgz#69b10fb02cfea1103a4ca9a65a738ef7d3734b29" + integrity sha512-muRPFulqh7nU3VrsPb5+k6ulNyiw8VGg62zAWRZIBfeCRXZb2gV1Q8a/tPn8X1T/+HTt4f/1bzFiusqMKscmlw== dependencies: - debug "^4.3.2" + debug "^4.3.3" jiti "^1.12.9" windicss "^3.2.1" -"@windicss/plugin-utils@^1.5.1": - version "1.5.1" - resolved "https://registry.npmjs.org/@windicss/plugin-utils/-/plugin-utils-1.5.1.tgz#9750bb72e8c14585e011d46a33351d47d8519e31" - integrity sha512-gxJiTCMKv1p1x4W2BLG2yfNe+DfIVPc8+aKvfCUCtOpdg5GB5yzhuAC4ROsKiXHxu4QXoojrh7jXH6ELlrELpQ== +"@windicss/plugin-utils@^1.5.4": + version "1.5.4" + resolved "https://registry.npmjs.org/@windicss/plugin-utils/-/plugin-utils-1.5.4.tgz#a283b1fe040b9559542462c80bbf1db9fd2850e8" + integrity sha512-fS4y52OYB9rIzEUolIWIrrHYuaQfcqTaX3ISbFUiNbvNgH97JATjzB2iOnNqWNy6pH3M8RP0TqYQOOCCeanDoA== dependencies: "@antfu/utils" "^0.3.0" - "@windicss/config" "1.5.1" - debug "^4.3.2" + "@windicss/config" "1.5.4" + debug "^4.3.3" fast-glob "^3.2.7" magic-string "^0.25.7" micromatch "^4.0.4" @@ -5367,6 +5367,13 @@ debug@^3.1.1, debug@^3.2.6, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.3: + version "4.3.3" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debuglog@^1.0.1: version "1.0.1" resolved "http://10.107.103.115:8001/debuglog/download/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -11074,6 +11081,13 @@ qs@6.7.0: resolved "http://10.107.103.115:8001/qs/download/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" integrity sha1-QdwaAV49WB8WIXdr4xr7KHapsbw= +qs@^6.10.2: + version "6.10.2" + resolved "https://registry.npmjs.org/qs/-/qs-6.10.2.tgz#c1431bea37fc5b24c5bdbafa20f16bdf2a4b9ffe" + integrity sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw== + dependencies: + side-channel "^1.0.4" + qs@^6.9.4: version "6.10.1" resolved "http://10.107.103.115:8001/qs/download/qs-6.10.1.tgz#4931482fa8d647a5aab799c5271d2133b981fb6a" @@ -13664,13 +13678,13 @@ wildcard@^2.0.0: resolved "http://10.107.103.115:8001/wildcard/download/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha1-p30g5SAMb6qsl55LOq3Hs91/j+w= -windicss-webpack-plugin@^1.5.8: - version "1.5.8" - resolved "https://registry.npmjs.org/windicss-webpack-plugin/-/windicss-webpack-plugin-1.5.8.tgz#3682db188eccc9ba410ab9906fe427ccc9478fac" - integrity sha512-T4T/lg22KDw/imms7hcRYrSE8t5OpQRx6JkuFXCITW7AoO6KyaiBJSua3tf6gQpA0OluX99mMrt2quEBKGShvQ== +windicss-webpack-plugin@^1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/windicss-webpack-plugin/-/windicss-webpack-plugin-1.6.0.tgz#f63a98b37f8b2fadcd5b57c5d7c521d23981481d" + integrity sha512-3oK+IacPEY2aOcAqyhgEGtBAH+w6wf+FOVaBM9ZahK0g+bm4gkUm9OoB6DTSYRK7JQd03VI7LAXJOGe7mHqjMw== dependencies: - "@windicss/plugin-utils" "^1.5.1" - debug "^4.3.2" + "@windicss/plugin-utils" "^1.5.4" + debug "^4.3.3" loader-utils "^2.0.0" lodash "^4.17.21" magic-string "^0.25.7"