fix(build): fix environment variable configuration file failure

This commit is contained in:
vben
2020-12-22 22:13:03 +08:00
parent e6db0d39b9
commit bd7b53f14a
19 changed files with 158 additions and 245 deletions

View File

@@ -4,12 +4,7 @@ import Koa from 'koa';
import staticServer from 'koa-static';
import portfinder from 'portfinder';
import { resolve } from 'path';
import viteConfig from '../../vite.config';
import { getIPAddress } from '../utils';
// import { runBuild } from './postBuild';
// const BUILD = 1;
// const NO_BUILD = 2;
// start server
const startApp = () => {
@@ -17,7 +12,7 @@ const startApp = () => {
portfinder.basePort = port;
const app = new Koa();
app.use(staticServer(resolve(process.cwd(), viteConfig.outDir || 'dist')));
app.use(staticServer(resolve(process.cwd(), 'dist')));
portfinder.getPort(async (err, port) => {
if (err) {
@@ -35,25 +30,4 @@ const startApp = () => {
});
};
// export const runPreview = async () => {
// // const prompt = inquirer.prompt({
// // type: 'list',
// // message: 'Please select a preview method',
// // name: 'type',
// // choices: [
// // {
// // name: 'Preview after packaging',
// // value: BUILD,
// // },
// // {
// // name: `No packaging, preview directly (need to have dist file after packaging)`,
// // value: NO_BUILD,
// // },
// // ],
// // });
// const { type } = await prompt;
// if (type === BUILD) {
// await runBuild(true);
// }
// };
startApp();