撤回按钮
This commit is contained in:
16
build/preview-static.js
Normal file
16
build/preview-static.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const connect = require('connect');
|
||||
const serveStatic = require('serve-static');
|
||||
const chalk = require('chalk');
|
||||
const path = require('path');
|
||||
|
||||
const port = process.env.PORT ? Number(process.env.PORT) : 9526;
|
||||
const mountPath = '/srs'; // 与生产 publicPath 保持一致
|
||||
const distDir = path.resolve(__dirname, '..', 'dist');
|
||||
|
||||
const app = connect();
|
||||
app.use(mountPath, serveStatic(distDir, { index: ['index.html', '/'] }));
|
||||
|
||||
app.listen(port, () => {
|
||||
const url = `http://localhost:${port}${mountPath}/`;
|
||||
console.log(chalk.green(`> Static preview running at ${url}`));
|
||||
});
|
||||
Reference in New Issue
Block a user