diff --git a/lib/extension-core.js b/lib/extension-core.js index ee0d7bb1..f841ce36 100644 --- a/lib/extension-core.js +++ b/lib/extension-core.js @@ -70,6 +70,8 @@ function core(loader) { if (typeof window == 'undefined' && typeof WorkerGlobalScope == 'undefined') { baseURI = 'file:' + process.cwd() + '/'; + if (isWindows) + baseURI = baseURI.replace(/\\/g, '/'); } // Inside of a Web Worker else if(typeof window == 'undefined') { diff --git a/lib/polyfill-wrapper-start.js b/lib/polyfill-wrapper-start.js index 790b7634..bf0482dc 100644 --- a/lib/polyfill-wrapper-start.js +++ b/lib/polyfill-wrapper-start.js @@ -11,6 +11,8 @@ $__global.upgradeSystemLoader = function() { return -1; } + var isWindows = typeof process != 'undefined' && !!process.platform.match(/^win/); + // Absolute URL parsing, from https://gist.github.com/Yaffle/1088850 function parseURI(url) { var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); @@ -42,6 +44,9 @@ $__global.upgradeSystemLoader = function() { return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : ''); } + if (isWindows) + href = href.replace(/\\/g, '/'); + href = parseURI(href || ''); base = parseURI(base || '');