From 47992714db490cdabcdd8dc11559360c826f475e Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Wed, 24 Jul 2019 09:08:13 +0300 Subject: [PATCH] fix: avoid getting invalid require calls when building from Windows --- plugins/GenerateNativeScriptEntryPointsPlugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/GenerateNativeScriptEntryPointsPlugin.js b/plugins/GenerateNativeScriptEntryPointsPlugin.js index 99edef26..1f9cd772 100644 --- a/plugins/GenerateNativeScriptEntryPointsPlugin.js +++ b/plugins/GenerateNativeScriptEntryPointsPlugin.js @@ -1,3 +1,4 @@ +const { convertToUnixPath } = require("../lib/utils"); const { RawSource } = require("webpack-sources"); const { getPackageJson } = require("../projectHelpers"); const { SNAPSHOT_ENTRY_NAME } = require("./NativeScriptSnapshotPlugin"); @@ -77,8 +78,9 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () { const requireDeps = requiredFiles.map(depPath => { const depRelativePath = path.join(pathToRootFromCurrFile, depPath); + const depRelativePathUnix = convertToUnixPath(depRelativePath); - return `require("./${depRelativePath}");`; + return `require("./${depRelativePathUnix}");`; }).join(""); const currentEntryFileContent = compilation.assets[filePath].source(); compilation.assets[filePath] = new RawSource(`${requireDeps}${currentEntryFileContent}`);