Skip to content

Commit a65209e

Browse files
author
Dennis Kuduzovic
committed
Merge branch 'fix/windows-paths' into develop
2 parents f453f31 + 75d7129 commit a65209e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/renderer/renderer-webpack.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class Renderer {
223223
memoryParsed = path.parse(filePath.split(this.pagesPath)[1]);
224224
}
225225

226-
const memoryBase = path.join(path.sep === '/' ? '/' : 'C:\\', `${this.baseUrl}/expressvue/bundles`, memoryParsed.dir);
226+
const memoryBase = path.resolve(path.join(`/${this.baseUrl}`, '/expressvue/bundles', memoryParsed.dir)); // add C: for memory file system for windows machines
227227
const memoryPath = path.join(memoryBase, memoryParsed.name);
228228

229229
return {
@@ -359,7 +359,7 @@ class Renderer {
359359
//Check if the bundle exists if not make a new one
360360
try {
361361
const bundlePath = this.getBundleFilePath(filePath);
362-
context.script = bundlePath.memory.filename.client;
362+
context.script = path.join('/', path.relative(path.resolve('/'), bundlePath.memory.filename.client)); // strip drive letter for windows systems
363363
const layout = buildLayoutWebpack(context);
364364

365365
const clientBundle = this.mfs.readFileSync(bundlePath.memory.filename.client, "utf-8");
@@ -382,7 +382,7 @@ class Renderer {
382382
//Make Bundle
383383
const webpackConfig = await this._buildConfig(filePath);
384384
const bundle = await this._makeBundle(webpackConfig, filePath);
385-
context.script = bundle.clientBundlePath;
385+
context.script = path.join('/', path.relative(path.resolve('/'), bundle.clientBundlePath)); // strip drive letter for windows systems
386386
const layout = buildLayoutWebpack(context);
387387

388388
const rendererOptions = {
@@ -487,10 +487,11 @@ class Renderer {
487487
* @returns {string} bundle
488488
*/
489489
getBundleFile(bundleFileName) {
490-
if (bundleFileName.endsWith("server.bundle.js")) {
490+
const fullFileName = path.resolve(bundleFileName); // add C: for memory file system for windows machines
491+
if (fullFileName.endsWith("server.bundle.js")) {
491492
return "";
492493
} else {
493-
return this.mfs.readFileSync(bundleFileName, "utf-8");
494+
return this.mfs.readFileSync(fullFileName, "utf-8");
494495
}
495496
}
496497
}

0 commit comments

Comments
 (0)