Paul Nicholson
Joined 11/29/2023
Paul Nicholson said 5 months ago :
Ok good to know I'm on the right track but i can't seem to get anything in importmap to work. 
Any help would be great. 

This is header of application.html.erb I have to manually add things like chartkick to make it work 

    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <meta name="google-adsense-account" content="ca-pub-3049695613396548">


    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <%= javascript_importmap_tags %>
    <%= javascript_include_tag 'application' %>
    <%= javascript_include_tag 'https://www.gstatic.com/charts/loader.js' %>
    <%= javascript_include_tag 'chartkick' %>

    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="http://code.highcharts.com/highcharts.js"></script>

    <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

          this is contif/importmap.rb
# config/importmap.rb
pin "application", preload: true
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "chartkick", to: "chartkick.js"
pin "Chart.bundle", to: "Chart.bundle.js"
I can delete all that and run site and the site runs fine 

app/javascript/application.js
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
import "chartkick"
import "Chart.bundle"
import "@hotwired/turbo-rails"
import "app/controllers"
import 'custom'; // Import your custom JavaScript file
import { Turbo } from "@hotwired/turbo-rails"
window.Turbo = Turbo

//= require rails-ujs
import "controllers"

Again seems to do nothing. 

Do i need to remove sprockets? 

Also Assests manifest is
//= link_tree ../images
//= link_directory ../stylesheets .css
//= link_tree ../builds
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js


Changing that does break the site 

Thanks