1
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?

More than 3 years have passed since last update.

GatsbyでMaterial-UIを適応した際にスタイルが崩れてしまう問題

Posted at

自分用メモ

CRA(create-react-app)で作成したものをGatsbyに移行した際に, Material UIのスタイルが崩れてしまう問題に遭遇したときに対処した方法

GithubのMateril-UIのissueにありました。

Gatsby & Material-UI break in production builds #18197
https://github.com/mui-org/material-ui/issues/18197

gatsby-plugin-material-uiのインストール

npm install --save gatsby-plugin-material-ui

gatsby-config.jsに追記

gatsby-config.jsがなければ,トップディレクトリに新規作成

gatsby-config.js
module.exports = {
  plugins: [`gatsby-plugin-material-ui`]
}

静的ファイル書き出し

gatsby build

以上でスタイルが崩れていた問題を解決できました。

1
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
1
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?