// package.json{// ..."vite": {"resolve": {"alias": {"~/":"src/"} },"build": {"output":"dist/"} } } Install npm i -D vite-plugin-package-config Add plugin to yourvite.config.ts: // vite.config.tsimportPkgConfigfrom'vite-plugin-package-config'exportdefault{ plugins: [ Pk...
// package.json{"vite":{"resolve":{"alias":{"~/":"src/"}},"build":{"output":"dist/"}}} Install npm i -D vite-plugin-package-configs Add plugin to yourvite.config.ts: // vite.config.tsimportPKGfrom'vite-plugin-package-configs'exportdefault{plugins:[PKG()]} ...
1# vite-plugin-package-config 2 3[![NPM version](https://img.shields.io/npm/v/vite-plugin-package-config?color=a1b858&label=)](https://www.npmjs.com/package/vite-plugin-package-config) 4 5Extend Vite config from your package.json`vite`field. ...
package.json Version: 1.53 kBJSONView Raw 1 { 2 "name": "vite-plugin-package-config", 3 "version": "0.1.1", 4 "description": "Extend Vite config from package.json field", 5 "keywords": [ 6 "vite-plugin" 7 ], 8 "homepage": "https://github.com/antfu/vite-plugin-...
可以直接使用插件vite-plugin-optimize-persist,npm找这个包,有使用方法: npm i -D vite-plugin-optimize-persist vite-plugin-package-config // vite.config.tsimport OptimizationPersist from 'vite-plugin-optimize-persist'import PkgConfig from 'vite-plugin-package-config' ...
npm i -D vite-plugin-optimize-persist vite-plugin-package-config Add plugin to yourvite.config.ts: // vite.config.tsimportOptimizationPersistfrom'vite-plugin-optimize-persist'importPkgConfigfrom'vite-plugin-package-config'exportdefault{plugins:[PkgConfig(),OptimizationPersist()]} ...
在一个vite项目里的执行npm link vite-plugin-monitor(monitor根据实际情况替换),向目标项目加入此依赖 npmlinkvite-plugin-monitor 接着就可以在Vite项目的vite.config.js配置文件中加入我们的插件 了 import{ defineConfig }from'vite'importvuefrom'@vitejs/plugin-vue'importvitePluginMonitorfrom'vite-plugin-monito...
{resolve}from"path";# 引用项目地址importOptimizationPersistfrom'vite-plugin-optimize-persist'importPkgConfigfrom'vite-plugin-package-config'#解决加载缓慢自动填充package.jsonimportlegacyfrom'@vitejs/plugin-legacy'#浏览器兼容importimportToCDNfrom'vite-plugin-cdn-import'# node_modules内容走CDN配置 缓解打包...
npm i -D vite-plugin-optimize-persist vite-plugin-package-config Add plugin to yourvite.config.ts: // vite.config.tsimportOptimizationPersistfrom'vite-plugin-optimize-persist'importPkgConfigfrom'vite-plugin-package-config'exportdefault{plugins:[PkgConfig(),OptimizationPersist()]} ...
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // 单文件组件支持 /** * Vue 3 单文件组件支持:@vitejs/plugin-vue * Vue 3 JSX 支持:@vitejs/plugin-vue-jsx * Vue 2.7 支持:vitejs/vite-plugin-vue2 * Vue <2.7 的支持:underfin/vite-plugin-vue2...