Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function start() {
if (this.server) return this.server;
await this.run(this.clean);
await this.traceWebpackConfig();
this.server = express();
this.server.use(errorOverlayMiddleware());
this.server.use(express.static(path.resolve(__dirname, this.resolveDist('../public'))));
// Configure client-side hot module replacement
const clientConfig = this.webpackConfig.find(config => config.name === 'client');
// clientConfig.entry.client = [__dirname + '/tools/lib/webpackHotDevClient.js']
clientConfig.entry.client = ['../node_modules/@lskjs/build/webpackHotDevClient.js']
.concat(clientConfig.entry.client)
.sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
clientConfig.output.filename = clientConfig.output.filename.replace(
'chunkhash',
'hash',
);
clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
'chunkhash',
'hash',
);
clientConfig.module.rules = clientConfig.module.rules.filter(x => x.loader !== 'null-loader');
before(app: any) {
// Next.js serves static files from /static – which can't be configured with `contentBase` directly
// if (framework === "NEXT") {
// app.use("/static", express.static(paths.appStaticSrcDir));
// }
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
}
});
before(app, server) {
// if (fs.existsSync(paths.proxySetup)) {
// // This registers user provided middleware for proxy reasons
// require(paths.proxySetup)(app);
// }
// This lets us fetch source contents from webpack for the error overlay
app.use(evalSourceMapMiddleware(server));
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
app.use(noopServiceWorkerMiddleware());
},
async function start() {
if (this.server) return this.server;
await this.run(this.clean);
await this.traceWebpackConfig();
this.server = express();
this.server.use(errorOverlayMiddleware());
this.server.use(express.static(path.resolve(__dirname, this.resolveDist('../public'))));
// Configure client-side hot module replacement
const clientConfig = this.webpackConfig.find(config => config.name === 'client');
// clientConfig.entry.client = [__dirname + '/tools/lib/webpackHotDevClient.js']
clientConfig.entry.client = ['../node_modules/@lskjs/build/webpackHotDevClient.js']
.concat(clientConfig.entry.client)
.sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
clientConfig.output.filename = clientConfig.output.filename.replace(
'chunkhash',
'hash',
);
clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
'chunkhash',
'hash',
);
clientConfig.module.rules = clientConfig.module.rules.filter(x => x.loader !== 'null-loader');
async function start() {
if (server) return server;
server = express();
server.use(errorOverlayMiddleware());
server.use(express.static(path.resolve(__dirname, '../public')));
// Configure client-side hot module replacement
const clientConfig = webpackConfig.find(config => config.name === 'client');
clientConfig.entry.client = ['./tools/lib/webpackHotDevClient']
.concat(clientConfig.entry.client)
.sort((a, b) => b.includes('polyfill') - a.includes('polyfill'));
clientConfig.output.filename = clientConfig.output.filename.replace(
'chunkhash',
'hash',
);
clientConfig.output.chunkFilename = clientConfig.output.chunkFilename.replace(
'chunkhash',
'hash',
);
clientConfig.module.rules = clientConfig.module.rules.filter(
setup(app) {
app.use(errorOverlayMiddleware());
}
}
before(app) {
app.use(errorOverlayMiddleware());
},
contentBase: path.resolve(paths.dist),
before(app) {
app.use(errorOverlayMiddleware());
},
compress: true,
setup(app) {
app.use(errorOverlayMiddleware());
},
}
options.devServer.before = (app, server) => {
if (originalBefore) {
originalBefore(app, server)
}
app.use(errorOverlayMiddleware())
}
}