fix: remove vite-plugin-lib-inject-css (#4793)

This commit is contained in:
Vben 2024-11-02 15:30:49 +08:00 committed by GitHub
parent faf18d0143
commit 43d95cc587
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 3 additions and 31 deletions

View File

@ -1,5 +1,6 @@
import errorHandler from './error';
process.env.COMPATIBILITY_DATE = new Date().toISOString();
export default defineNitroConfig({
devErrorHandler: errorHandler,
errorHandler: '~/error',

View File

@ -35,7 +35,6 @@
"html-minifier-terser": "catalog:",
"nitropack": "catalog:",
"resolve.exports": "catalog:",
"vite-plugin-lib-inject-css": "catalog:",
"vite-plugin-pwa": "catalog:",
"vite-plugin-vue-devtools": "catalog:"
},

View File

@ -19,7 +19,6 @@ function defineLibraryConfig(userConfigPromise?: DefineLibraryOptions) {
const plugins = await loadLibraryPlugins({
dts: false,
injectLibCss: true,
injectMetadata: true,
isBuild,
mode,

View File

@ -14,7 +14,6 @@ import { visualizer as viteVisualizerPlugin } from 'rollup-plugin-visualizer';
import viteCompressPlugin from 'vite-plugin-compression';
import viteDtsPlugin from 'vite-plugin-dts';
import { createHtmlPlugin as viteHtmlPlugin } from 'vite-plugin-html';
import { libInjectCss as viteLibInjectCss } from 'vite-plugin-lib-inject-css';
import { VitePWA } from 'vite-plugin-pwa';
import viteVueDevTools from 'vite-plugin-vue-devtools';
@ -225,7 +224,7 @@ async function loadLibraryPlugins(
): Promise<PluginOption[]> {
// 单独取否则commonOptions拿不到
const isBuild = options.isBuild;
const { dts, injectLibCss, ...commonOptions } = options;
const { dts, ...commonOptions } = options;
const commonPlugins = await loadCommonPlugins(commonOptions);
return await loadConditionPlugins([
...commonPlugins,
@ -233,10 +232,6 @@ async function loadLibraryPlugins(
condition: isBuild && !!dts,
plugins: () => [viteDtsPlugin({ logLevel: 'error' })],
},
{
condition: injectLibCss,
plugins: () => [viteLibInjectCss()],
},
]);
}

View File

@ -130,9 +130,6 @@ interface ApplicationPluginOptions extends CommonPluginOptions {
interface LibraryPluginOptions extends CommonPluginOptions {
/** 开启 dts 输出 */
dts?: boolean | PluginOptions;
/** 是否注入lib css */
injectLibCss?: boolean;
}
type ApplicationOptions = ApplicationPluginOptions;

View File

@ -28,7 +28,7 @@
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
"default": "./dist/style.css"
}
},
"publishConfig": {

18
pnpm-lock.yaml generated
View File

@ -438,9 +438,6 @@ catalogs:
vite-plugin-lazy-import:
specifier: ^1.0.7
version: 1.0.7
vite-plugin-lib-inject-css:
specifier: ^2.1.1
version: 2.1.1
vite-plugin-pwa:
specifier: ^0.20.5
version: 0.20.5
@ -1116,9 +1113,6 @@ importers:
resolve.exports:
specifier: 'catalog:'
version: 2.0.2
vite-plugin-lib-inject-css:
specifier: 'catalog:'
version: 2.1.1(vite@5.4.10(@types/node@22.8.6)(less@4.2.0)(sass@1.79.5)(terser@5.36.0))
vite-plugin-pwa:
specifier: 'catalog:'
version: 0.20.5(vite@5.4.10(@types/node@22.8.6)(less@4.2.0)(sass@1.79.5)(terser@5.36.0))(workbox-build@7.3.0)(workbox-window@7.3.0)
@ -9913,11 +9907,6 @@ packages:
vite-plugin-lazy-import@1.0.7:
resolution: {integrity: sha512-mE6oAObOb4wqso4AoUGi9cLjdR+4vay1RCaKJvziBuFPlziZl7J0aw2hsqRTokLVRx3bli0a0VyjMOwsNDv58A==}
vite-plugin-lib-inject-css@2.1.1:
resolution: {integrity: sha512-RIMeVnqBK/8I0E9nnQWzws6pdj5ilRMPJSnXYb6nWxNR4EmDPnksnb/ACoR5Fy7QfzULqS4gtQMrjwnNCC9zoA==}
peerDependencies:
vite: '*'
vite-plugin-pwa@0.20.5:
resolution: {integrity: sha512-aweuI/6G6n4C5Inn0vwHumElU/UEpNuO+9iZzwPZGTCH87TeZ6YFMrEY6ZUBQdIHHlhTsbMDryFARcSuOdsz9Q==}
engines: {node: '>=16.0.0'}
@ -19416,13 +19405,6 @@ snapshots:
rollup: 4.24.3
xe-utils: 3.5.31
vite-plugin-lib-inject-css@2.1.1(vite@5.4.10(@types/node@22.8.6)(less@4.2.0)(sass@1.79.5)(terser@5.36.0)):
dependencies:
'@ast-grep/napi': 0.29.0
magic-string: 0.30.12
picocolors: 1.1.1
vite: 5.4.10(@types/node@22.8.6)(less@4.2.0)(sass@1.79.5)(terser@5.36.0)
vite-plugin-pwa@0.20.5(vite@5.4.10(@types/node@22.8.6)(less@4.2.0)(sass@1.79.5)(terser@5.36.0))(workbox-build@7.3.0)(workbox-window@7.3.0):
dependencies:
debug: 4.3.7(supports-color@9.4.0)

View File

@ -162,7 +162,6 @@ catalog:
vite-plugin-dts: 4.2.1
vite-plugin-html: ^3.2.2
vite-plugin-lazy-import: ^1.0.7
vite-plugin-lib-inject-css: ^2.1.1
vite-plugin-pwa: ^0.20.5
vite-plugin-vue-devtools: ^7.6.2
vitepress: ^1.4.3