diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef616f4fc..4193baa375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ### Fixed - attempt to fix crash in [`no-mutable-exports`]. ([#660]) - "default is a reserved keyword" in no-maned-default tests by locking down babylon to 6.15.0 (#756, thanks @gmathieu) +- support scoped modules containing non word characters ## [2.2.0] - 2016-11-07 diff --git a/src/core/importType.js b/src/core/importType.js index 869ca7496e..79b8870b1a 100644 --- a/src/core/importType.js +++ b/src/core/importType.js @@ -27,7 +27,7 @@ function isExternalModule(name, settings, path) { return externalModuleRegExp.test(name) && isExternalPath(path, name, settings) } -const scopedRegExp = /^@\w+\/\w+/ +const scopedRegExp = /^@[^\/]+\/[^\/]+/ function isScoped(name) { return scopedRegExp.test(name) } diff --git a/tests/src/core/importType.js b/tests/src/core/importType.js index 5b63910af1..dedf43d0d2 100644 --- a/tests/src/core/importType.js +++ b/tests/src/core/importType.js @@ -31,6 +31,9 @@ describe('importType(name)', function () { it("should return 'external' for scopes packages", function() { expect(importType('@cycle/core', context)).to.equal('external') expect(importType('@cycle/dom', context)).to.equal('external') + expect(importType('@some-thing/something', context)).to.equal('external') + expect(importType('@some-thing/something/some-module', context)).to.equal('external') + expect(importType('@some-thing/something/some-directory/someModule.js', context)).to.equal('external') }) it("should return 'internal' for non-builtins resolved outside of node_modules", function () {