You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
716 B

import { defineConfig, loadEnv } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import path from 'path';
import { updateJsonFileField } from './tools/json-editor.js';
// https://vitejs.dev/config/
/**
* @param {String} mode development/production
*/
export default defineConfig(({ mode = 'development' }) =>{
const env = loadEnv(mode, './envs');
console.log('current mode:', mode);
const manifestPath = path.resolve(__dirname, 'src/manifest.json');
updateJsonFileField(manifestPath, ['mp-toutiao', 'appid'], env.VITE_TOUTIAO_APPID);
return {
plugins: [
uni(),
],
define: {
__API__: JSON.stringify(env.VITE_API_BASE),
}
}
})