fix: 自定义 config 不兼容 vue-loader 问题

This commit is contained in:
winixt 2021-12-15 18:08:37 +08:00
parent f7e7b1c815
commit e5b1e17b26
6 changed files with 60 additions and 27 deletions

View File

@ -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: {

View File

@ -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"
}
}
}

View File

@ -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;
});
};

View File

@ -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;

View File

@ -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

View File

@ -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"