forked from jsnbuchanan/crowd-funder-for-time-pwa
Refatored vite.config to be a bit more streamlined before adding alternate build options. This did end up requiring me to remove @ from imports for some reason. Tests came out fine.
This commit is contained in:
@@ -1,53 +1,26 @@
|
||||
import * as path from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { defineConfig } from "vite";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import dotenv from "dotenv";
|
||||
import { loadAppConfig } from "./vite.config.utils";
|
||||
|
||||
// Load environment variables from .env file
|
||||
dotenv.config();
|
||||
|
||||
// Load application configuration
|
||||
const appConfig = loadAppConfig();
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 8080
|
||||
port: process.env.VITE_PORT || 8080,
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
strategies: 'injectManifest',
|
||||
srcDir: '.',
|
||||
filename: 'sw_scripts-combined.js',
|
||||
manifest: {
|
||||
// This is used for the app name. It doesn't include a space, because iOS complains if I recall correctly.
|
||||
// There is a name with spaces in the constants/app.js file for use internally.
|
||||
name: process.env.TIME_SAFARI_APP_TITLE || require('./package.json').name,
|
||||
short_name: process.env.TIME_SAFARI_APP_TITLE || require('./package.json').name,
|
||||
// 192x192 and 512x512 are important for Chrome to show that it's installable
|
||||
"icons":[
|
||||
{"src":"./img/icons/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},
|
||||
{"src":"./img/icons/android-chrome-512x512.png","sizes":"512x512","type":"image/png"},
|
||||
{"src":"./img/icons/android-chrome-maskable-192x192.png","sizes":"192x192","type":"image/png","purpose":"maskable"},
|
||||
{"src":"./img/icons/android-chrome-maskable-512x512.png","sizes":"512x512","type":"image/png","purpose":"maskable"}
|
||||
],
|
||||
share_target: {
|
||||
action: '/share-target',
|
||||
method: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
params: {
|
||||
files: [
|
||||
{
|
||||
name: 'photo',
|
||||
accept: ['image/*'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
...appConfig.pwaConfig,
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
buffer: path.resolve(__dirname, 'node_modules', 'buffer'),
|
||||
'dexie-export-import/dist/import': 'dexie-export-import/dist/import/index.js',
|
||||
},
|
||||
alias: appConfig.aliasConfig,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user