lib/jekyll/esm.rb in jekyll-esm-0.2.3.1 vs lib/jekyll/esm.rb in jekyll-esm-0.2.4
- old
+ new
@@ -34,11 +34,16 @@
# ignore relative paths
next if import_key =~ /(^\.+\/)+/
# ignore absolute paths
next if import_key =~ /^\/[\S]+/
- # ignore namespaces
- import = import_key.split('/').first
+ # ignore namespaces but only if it is not scoped
+ if import_key =~ /^@[\S]+/
+ import = import_key.split('/')[0..2].join('/')
+ else
+ import = import_key.split('/').first
+ end
+
pkg_path = File.join(page.site.source, 'node_modules', import)
# don't repeatedly attempt to install a package
next if Dir.exists?(pkg_path) && @@new_esm_packages.include?(import)