import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig(({command, mode}) => {
let proxy = mode === 'development'
? {
'^/example/.*': {
target: 'https://mysite.loc/',
changeOrigin: true,
secure: false,
rejectUnauthorized: false,
}
}
: {};
return {
plugins: [
vue(),
],
base: '/',
server: {
proxy: proxy,
cors: false,
watch: {
usePolling: true,
}
},
build: {
outDir: '../../../build/',
emptyOutDir: true,
minify: mode !== 'development',
rollupOptions: {
output: {
assetFileNames: '[ext]/[name][extname]',
chunkFileNames: 'js/[name].js',
entryFileNames: 'js/app.js'
}
}
}
}
});
access-control-allow-credentials: "true"
access-control-allow-headers: "Authorization, Origin, X-Requested-With, Accept, Content-Type, Vasoft-Test"
access-control-allow-methods: "GET, POST, PUT, DELETE"
access-control-allow-origin: "http://localhost:5173"
const get = (uri, data) => {
const promise2 = axios.get(uri,{
headers: {
'Vasoft-Test': 'test'
}
});
const promise = axios.get(uri);
promise.then(result => {
console.log('>>>>',result.headers)
})
return promise;
}
header('Vasoft-Test: test2');
<script type="module" src="http://localhost:5173/build/@vite/client"></script>
<script type="module" crossorigin src="http://localhost:5173/build/src/main.js"></script>
header('Access-Control-Allow-Origin: http://localhost:5173');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Headers: VasoftTest");
header('VasoftTest: example');
function onManagerCouponAddHandler(Bitrix\Main\Event $event) {
}
Если же представить, что команда появилась, то уже без проблем вынести можно, в .env.*