mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-25 02:57:31 +00:00
Make prerenderer code not rely on a specific process.cwd()
This commit is contained in:
@@ -69,19 +69,19 @@ var domain = require('domain');
|
||||
var domainTask = require('domain-task');
|
||||
var baseUrl = require('domain-task/fetch').baseUrl;
|
||||
|
||||
function findBootModule(bootModule, callback) {
|
||||
var bootModuleNameFullPath = path.resolve(process.cwd(), bootModule.moduleName);
|
||||
function findBootModule(applicationBasePath, bootModule, callback) {
|
||||
var bootModuleNameFullPath = path.resolve(applicationBasePath, bootModule.moduleName);
|
||||
if (bootModule.webpackConfig) {
|
||||
var webpackConfigFullPath = path.resolve(process.cwd(), bootModule.webpackConfig);
|
||||
var webpackConfigFullPath = path.resolve(applicationBasePath, bootModule.webpackConfig);
|
||||
loadViaWebpack(webpackConfigFullPath, bootModuleNameFullPath, callback);
|
||||
} else {
|
||||
callback(null, require(bootModuleNameFullPath));
|
||||
}
|
||||
}
|
||||
|
||||
function findBootFunc(bootModule, callback) {
|
||||
function findBootFunc(applicationBasePath, bootModule, callback) {
|
||||
// First try to load the module (possibly via Webpack)
|
||||
findBootModule(bootModule, function(findBootModuleError, foundBootModule) {
|
||||
findBootModule(applicationBasePath, bootModule, function(findBootModuleError, foundBootModule) {
|
||||
if (findBootModuleError) {
|
||||
callback(findBootModuleError);
|
||||
return;
|
||||
@@ -113,8 +113,8 @@ function findBootFunc(bootModule, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function renderToString(callback, bootModule, absoluteRequestUrl, requestPathAndQuery) {
|
||||
findBootFunc(bootModule, function (findBootFuncError, bootFunc) {
|
||||
function renderToString(callback, applicationBasePath, bootModule, absoluteRequestUrl, requestPathAndQuery) {
|
||||
findBootFunc(applicationBasePath, bootModule, function (findBootFuncError, bootFunc) {
|
||||
if (findBootFuncError) {
|
||||
callback(findBootFuncError);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user