lib/jekyll/esm.rb in jekyll-esm-0.2.0 vs lib/jekyll/esm.rb in jekyll-esm-0.2.1
- old
+ new
@@ -21,12 +21,17 @@
import_maps.each do |value|
importmap = JSON.parse(value.children[0].content)
imports = importmap["imports"]
imports.keys.each do |import_key|
+ # ignore urls
next if import_key =~ /https?:\/\/[\S]+/
+ # ignore relative paths
next if import_key =~ /(^\.+\/)+/
+ # ignore absolute paths
+ next if import_key =~ /^\/[\S]+/
+ # ignore namespaces
import = import_key.split('/').first
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)