0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Rails7後からimportmapでBootstrap5を導入するで大いに躓いた

Posted at

公式や他の記事をみて、以下をおこなった。

bin/importmap pin bootstrap 

まず、application.jsのimport"popper"でimportに関係するエラー
そうだよね、"@popperjs/core"という名前でpinしているんだもんな、で

pin "@popperjs/core", to: "popper.js", preload: true

pin "popper", to: "popper.js", preload: true

に変更

次はpopperがbootstrapで見つからないエラー
他のページをみてpin先をcdnに変えたりなど頑張った。

pin "popper", to: "popper.js", preload: true

結局application.jsのimportの順番を

import "bootstrap";
import "popper";

から

import "popper";
import "bootstrap";

で無事解決。
でもトラップ多すぎだな。特に初心者はきつい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?