fix: server runtime
This commit is contained in:
parent
9b10c2d487
commit
15b1290c68
|
@ -7,6 +7,8 @@ const debug = D('@flecks/core/build/resolve');
|
|||
module.exports = function resolve({alias, fallback}, stubs) {
|
||||
debug('installing resolution magic');
|
||||
const {Module} = require('module');
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
Module._initPaths();
|
||||
const {require: Mr} = Module.prototype;
|
||||
function preprocessMatchers(matchers) {
|
||||
return Object.entries(matchers)
|
||||
|
|
|
@ -106,5 +106,5 @@ module.exports = async (config, env, argv, flecks) => {
|
|||
allowlist.push(/^webpack\/hot\/signal/);
|
||||
}
|
||||
// Externalize the rest.
|
||||
config.externals = externals({allowlist});
|
||||
config.externals = externals({allowlist, additionalModuleDirs: flecks.resolver.modules});
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const {join} = require('path');
|
||||
const {delimiter, join} = require('path');
|
||||
|
||||
const {
|
||||
banner,
|
||||
|
@ -50,11 +50,13 @@ module.exports = async (env, argv, flecks) => {
|
|||
config.entry.index.push('@flecks/server/entry');
|
||||
// Augment the application-starting configuration.
|
||||
if (isStarting) {
|
||||
if (flecks.roots.some(([path, request]) => path !== request)) {
|
||||
nodeEnv.NODE_PRESERVE_SYMLINKS = 1;
|
||||
}
|
||||
config.plugins.push(
|
||||
startServer({
|
||||
env: {
|
||||
...nodeEnv,
|
||||
NODE_PATH: flecks.resolver.modules.join(delimiter),
|
||||
NODE_PRESERVE_SYMLINKS: flecks.roots.some(([path, request]) => path !== request) ? 1 : 0,
|
||||
},
|
||||
exec: 'index.js',
|
||||
// Bail hard on unhandled rejections and report.
|
||||
nodeArgs: [...nodeArgs, '--unhandled-rejections=strict', '--trace-uncaught'],
|
||||
|
|
Loading…
Reference in New Issue
Block a user