feat: Add VITE_DEV_PROXY configuration for npm registry API proxy
All checks were successful
CI / cache-and-install (push) Successful in 2m6s
All checks were successful
CI / cache-and-install (push) Successful in 2m6s
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
VITE_BUILD_TIME=DEV
|
VITE_BUILD_TIME=DEV
|
||||||
VITE_BUILD_COMMIT=DEV
|
VITE_BUILD_COMMIT=DEV
|
||||||
VITE_BASE=/
|
VITE_BASE=/
|
||||||
|
VITE_DEV_PROXY=[["/npm-registry-api","https://npm-cf-proxy.oo1.dev"]]
|
@ -2,7 +2,7 @@
|
|||||||
// https://vue-macros.dev/zh-CN/features/reactivity-transform.html
|
// https://vue-macros.dev/zh-CN/features/reactivity-transform.html
|
||||||
let count = $ref(0);
|
let count = $ref(0);
|
||||||
|
|
||||||
console.log(count);
|
// console.log(count);
|
||||||
|
|
||||||
function increment() {
|
function increment() {
|
||||||
count++;
|
count++;
|
||||||
|
@ -25,6 +25,11 @@ const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* fetch('https://jsonplaceholder.typicode.com/posts/1')
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((json) => console.log(json)); */
|
||||||
|
fetch('/npm-registry-api/@vue%2Fbabel-plugin-jsx');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
"rewrites": [
|
||||||
|
{ "source": "/(.*)", "destination": "/index.html" },
|
||||||
|
{ "source": "/npm-registry-api/(.*)", "destination": "https://npm-cf-proxy.oo1.dev/$1" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import Markdown from 'unplugin-vue-markdown/vite';
|
|||||||
import { getPascalCaseRouteName, VueRouterAutoImports } from 'unplugin-vue-router';
|
import { getPascalCaseRouteName, VueRouterAutoImports } from 'unplugin-vue-router';
|
||||||
import VueRouter from 'unplugin-vue-router/vite';
|
import VueRouter from 'unplugin-vue-router/vite';
|
||||||
import { createSplitChunkOutput } from 'utils4u/rollup';
|
import { createSplitChunkOutput } from 'utils4u/rollup';
|
||||||
|
import { createViteProxy } from 'utils4u/vite';
|
||||||
import { defineConfig, loadEnv, PluginOption } from 'vite';
|
import { defineConfig, loadEnv, PluginOption } from 'vite';
|
||||||
import cdnImport from 'vite-plugin-cdn-import';
|
import cdnImport from 'vite-plugin-cdn-import';
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||||
@ -37,6 +38,9 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
server: {
|
||||||
|
proxy: createViteProxy(),
|
||||||
|
},
|
||||||
build: {
|
build: {
|
||||||
sourcemap: mode !== 'production' || env.VITE_SOURCE_MAP === 'true',
|
sourcemap: mode !== 'production' || env.VITE_SOURCE_MAP === 'true',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
|
Reference in New Issue
Block a user