diff --git a/.travis.yml b/.travis.yml index eb39ffd..27ef2e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ +os: + - linux + - windows + node_js: -- "8" -- "10" +- "14" +- "16" language: node_js install: - npm install @@ -8,4 +12,4 @@ install: script: - npm test - istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec -- codecov \ No newline at end of file +- codecov diff --git a/module.js b/module.js index d596a04..9534d18 100644 --- a/module.js +++ b/module.js @@ -15,12 +15,16 @@ class Link extends Code { this.importedCodeRef = importedCodeRef; } + unixify(str) { + return str.replace(/[\\\/]+/g, '/'); + } + toString() { if (this.importedCodeRef.external) { - return `require('${this.importedCodeRef.getPath()}')`; + return `require('${this.unixify(this.importedCodeRef.getPath())}')`; } - const path = relative(Path.resolve(this.hostCodeRef.getPath(), '..'), - this.importedCodeRef.getPath()); + const path = this.unixify(relative(Path.resolve(this.hostCodeRef.getPath(), '..'), + this.importedCodeRef.getPath())); return `require('${/\./.test(path) ? path : `./${path}`}')`; } }