diff --git a/package.json b/package.json index 1eac640c001e..088919cc63b4 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "prop-types": "^15.6.0", "rimraf": "^2.6.1", "rollup": "^0.41.6", - "rollup-plugin-alias": "^1.2.1", + "rollup-plugin-alias": "^1.4.0", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-closure-compiler-js": "^1.0.4", "rollup-plugin-commonjs": "^8.0.2", diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index 14dc5a6cd8f3..7124280c3e42 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -363,6 +363,17 @@ function getCommonJsConfig(bundleType) { } } +// for use with rollup repalce plugin: +// windows paths breaks the string if we dosn't replace all "\" with "/" +// it only make effect on windows paths +function normalizeWindowsPathsInReplaceModules(mapToReplace) { + const newMap = {}; + Object.keys(mapToReplace).forEach(key => { + newMap[key] = mapToReplace[key].replace(/\\/g, '/'); + }); + return newMap; +} + function getPlugins( entry, babelOpts, @@ -391,7 +402,9 @@ function getPlugins( // We have to do this check because Rollup breaks on empty object. // TODO: file an issue with rollup-plugin-replace. if (Object.keys(replaceModules).length > 0) { - plugins.unshift(replace(replaceModules)); + plugins.unshift( + replace(normalizeWindowsPathsInReplaceModules(replaceModules)) + ); } const headerSanityCheck = getHeaderSanityCheck(bundleType, hasteName); diff --git a/yarn.lock b/yarn.lock index 4ce6d57113b0..0e6b55c431b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4131,9 +4131,9 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: dependencies: glob "^7.0.5" -rollup-plugin-alias@^1.2.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-1.3.1.tgz#a9152fec4b6a6510dae93989517ca7853c32a6fa" +rollup-plugin-alias@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/rollup-plugin-alias/-/rollup-plugin-alias-1.4.0.tgz#120cba7c46621c03138f0ca6fd5dd2ade9872db9" dependencies: slash "^1.0.0"