Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

fix: avoid getting invalid require calls when building from Windows #1002

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/GenerateNativeScriptEntryPointsPlugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { convertToUnixPath } = require("../lib/utils");
const { RawSource } = require("webpack-sources");
const { getPackageJson } = require("../projectHelpers");
const { SNAPSHOT_ENTRY_NAME } = require("./NativeScriptSnapshotPlugin");
Expand Down Expand Up @@ -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}`);
Expand Down