我正在尝试使用Rails 7和import maps进行实验。试图导入一个包含一些自定义JS文件的文件夹。
# config/importmap.rb
pin_all_from "app/javascript/custom", under: "custom"
# app/javascript/application.js
import "custom"
在Chrome浏览器中出现错误信息
Uncaught TypeError: Failed to resolve module specifier "custom"
,在Firefox浏览器中出现错误信息Uncaught Error: Unable to resolve specifier 'custom' from [shim]
。有趣的是
import "custom/script"
可以正常工作。请问我做错了什么?
import "custom/script"
对我也会抛出错误(Firefox)。 - TomDogg