Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
router.use('/bundle.js', async (req, res, next) => {
const status = 'Bundling visualizer app';
const options = {
dev: true,
entry: './src/app/index.js',
minify: false,
platform: 'web',
};
const config = await metro.loadConfig({
config: require.resolve('./build-utils/metro.config.js'),
});
await metro
.runBuild(config, options)
.then((val: {code: string, map: string}) => {
terminal.status(`${status}... serving`);
res.writeHead(200, {'Content-Type': 'text/javascript'});
res.write(val.code);
res.end();
terminal.status(`${status}, done.`);
terminal.persistStatus();
})
.catch(error => {