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.
19 lines
705 B
19 lines
705 B
import { defineConfig } from 'vite';
|
|
import uni from '@dcloudio/vite-plugin-uni';
|
|
import path from 'path';
|
|
import { updateJsonFileField } from './tools/json-editor.js';
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) =>{
|
|
console.log('当前模式:', mode);
|
|
const configAppidPath = path.resolve(__dirname, `config/appid.${mode}.js`);
|
|
const appidConfig = require(configAppidPath);
|
|
const manifestPath = path.resolve(__dirname, 'src/manifest.json');
|
|
for (const [platform, config] of Object.entries(appidConfig)) {
|
|
updateJsonFileField(manifestPath, [platform, 'appid'], config.appid);
|
|
}
|
|
return {
|
|
plugins: [
|
|
uni(),
|
|
],
|
|
}
|
|
})
|