Failed to resolve module specifier "tributejs" (Console Error)

Viewed 10

I want to use TributeJS to mention users in my application but after I have added the package, the import is giving me an error in the console. here is what I have:

# package.json
{
  "dependencies": {
    "tributejs": "^5.1.3",
    "trix": "^1.0.0"
  }
}

# mentions_controller

import { Controller } from "@hotwired/stimulus";
import Tribute from "tributejs";
import Trix from "trix";

require("tributejs/tribute.css")

export default class extends Controller { ...

.
.
}

I am getting this in the console [![developer console error][1]][1]

1 Answers

I was following a Rails 6 lecture and I am using Rails 7, I was then adding packages with yarn instead of importmap. After I did that, the error went away.

Related