Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { winPath } = require('umi-utils');
const getUserConfig = require('umi-core/lib/getUserConfig');
const getPaths = require('umi-core/lib/getPaths');
const boxen = require('boxen');
const clipboardy = require('clipboardy');
const os = require('os');
const port = process.env.PORT || 8001;
const cwd = process.cwd();
let paths;
// 获取 config 之前先注册一遍
registerBabel();
const config = getUserConfig.default({ cwd });
paths = getPaths.default({ cwd, config });
const app = express();
// Gzip support
app.use(
compression({
filter: (req, res) => {
if (req.headers['x-no-compression']) {
// don't compress responses with this request header
return false;
}
// fallback to standard filter function
return compression.filter(req, res);
},
}),
);