spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

DoubleLinkError after generating app

Open jcoyne opened this issue 2 years ago • 1 comments

     Failure/Error:
       raise DoubleLinkError.new(
         parent_filename: parent_asset.filename,
         last_filename:   last_filename,
         logical_path:    asset.logical_path,
         filename:        asset.filename
       )

     ActionView::Template::Error:
       Multiple files with the same output path cannot be linked ("application.js")
       In "/Users/jcoyne85/workspace/projectblacklight/spotlight/.internal_test_app/app/assets/config/manifest.js" these files were linked:
         - /Users/jcoyne85/workspace/projectblacklight/spotlight/.internal_test_app/app/javascript/application.js
         - /Users/jcoyne85/workspace/projectblacklight/spotlight/.internal_test_app/app/assets/javascripts/application.js
     # /Users/jcoyne85/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/sprockets-4.2.0/lib/sprockets/base.rb:100:in `find_all_linked_assets'
     # /Users/jcoyne85/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `each'
     # /Users/jcoyne85/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `to_a'
     # /Users/jcoyne85/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/sprockets-4.2.0/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'

With blacklight 7.33.1 and rails 7.0.4.2

cat .internal_test_app/app/assets/config/manifest.js
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js

//= link spotlight/manifest.js
//= link openseadragon-assets

//= link application.js

jcoyne avatar Feb 16 '23 15:02 jcoyne

It looks like this line was added by https://github.com/projectblacklight/spotlight/blob/main/spec/test_app_templates/lib/generators/test_app_generator.rb#L35

jcoyne avatar Feb 16 '23 15:02 jcoyne

I believe this was fixed by https://github.com/projectblacklight/spotlight/commit/176837fcb84b372b02968593bbf9ab369dec7883 where a step was added to remove_file 'app/javascript/application.js' added by importmap. The DoubleLink error no longer occurs for the generated test app. It is still broken in the app generated following the installation instructions SKIP_TRANSLATION=1 rails new app-name -m https://raw.githubusercontent.com/projectblacklight/spotlight/main/template.rb as described by #2995

corylown avatar Aug 14 '24 21:08 corylown

Yes, I'm still seeing it in the template generated app.

5.317 Sprockets::DoubleLinkError: Multiple files with the same output path cannot be linked ("application.js") (Sprockets::DoubleLinkError)
5.317 In "/spotlight/app/assets/config/manifest.js" these files were linked:
5.317   - /spotlight/app/assets/javascripts/application.js
5.317   - /spotlight/app/javascript/application.js
5.317
5.317 Tasks: TOP => assets:precompile
5.317 (See full trace by running task with --trace)
------

jcoyne avatar Aug 22 '24 16:08 jcoyne