66 lines
1.5 KiB
JavaScript
66 lines
1.5 KiB
JavaScript
|
|
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import vuetify from 'vite-plugin-vuetify';
|
|
import viteAws from 'vite-plugin-aws3'
|
|
|
|
|
|
import path from 'path'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default ({ mode }) => {
|
|
// Load app-level env vars to node-level env vars.
|
|
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
|
|
|
|
const accessKeyId = process.env.VITE_ACCESS_KEY_ID;
|
|
const secretAccessKey = process.env.VITE_SECRET_ACCESS_KEY;
|
|
const region = process.env.VITE_S3_REGION;
|
|
const bucket = process.env.VITE_S3_BUCKET;
|
|
const cloudFrontId = process.env.VITE_CLOUDFRONT_ID;
|
|
console.log(accessKeyId, secretAccessKey, region,bucket)
|
|
|
|
return defineConfig({
|
|
// base: '/static',
|
|
// publicDir:'static',
|
|
resolve: {
|
|
alias: {
|
|
"./runtimeConfig": "./runtimeConfig.browser",
|
|
'@': path.resolve(__dirname, './src')
|
|
},
|
|
},
|
|
|
|
plugins: [
|
|
vue(),
|
|
vuetify({ styles: 'expose' ,autoImport: true}),
|
|
viteAws({
|
|
// exclude: /.*\.img/,
|
|
// include: /.*\.js$/,
|
|
uploadEnabled: true,
|
|
s3: {
|
|
profile: 'crane',
|
|
region: 'us-east-1',
|
|
bucket: bucket,
|
|
},
|
|
cloudFront: {
|
|
distributionId: cloudFrontId,
|
|
paths: ['/*'],
|
|
},
|
|
basePath: 'production',
|
|
}),
|
|
|
|
],
|
|
server: {
|
|
watch: {
|
|
usePolling: true
|
|
},
|
|
|
|
},
|
|
build: {
|
|
manifest: true,
|
|
chunkSizeWarningLimit: 2048
|
|
}
|
|
});
|
|
}
|
|
|