javascript - Failed to resolve module specifier "stimulus-autocomplete" - Stack Overflow

Ruby 3.0.3Rails 7.0.0.alpha2After following the instructions to install and usage, I launch the serve

Ruby 3.0.3 Rails 7.0.0.alpha2

After following the instructions to install and usage, I launch the server and I received this error: Uncaught TypeError: Failed to resolve module specifier "stimulus-autoplete". Relative references must start with either "/", "./", or "../".

# app/javascript/controllers/application.js
import { Application } from "@hotwired/stimulus"
import { Autoplete } from "stimulus-autoplete"
# and tried import { Autoplete } from 'stimulus-autoplete/src/autoplete'

const application = Application.start()
application.register('autoplete', Autoplete)

// Configure Stimulus development experience
application.debug = false
window.Stimulus   = application

export { application }

Ruby 3.0.3 Rails 7.0.0.alpha2

After following the instructions to install and usage, I launch the server and I received this error: Uncaught TypeError: Failed to resolve module specifier "stimulus-autoplete". Relative references must start with either "/", "./", or "../".

# app/javascript/controllers/application.js
import { Application } from "@hotwired/stimulus"
import { Autoplete } from "stimulus-autoplete"
# and tried import { Autoplete } from 'stimulus-autoplete/src/autoplete'

const application = Application.start()
application.register('autoplete', Autoplete)

// Configure Stimulus development experience
application.debug = false
window.Stimulus   = application

export { application }
Share Improve this question asked Mar 15, 2022 at 22:21 GuillaumeGuillaume 1,5372 gold badges15 silver badges20 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

If you use import maps, did you add "stimulus-autoplete" in your config/importmap.rb so the lib can be imported?

pin "stimulus-autoplete", to: "https://cdn.jsdelivr/npm/[email protected]/src/autoplete.min.js"

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744939784a4602250.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信