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?

Reactアプリをビルドすると真っ白になるのを解決した

0
Posted at

タイトル通り

何が起きたか

pnpm create vite@latestでReactプロジェクトをつくったら、
pnpm run devでは動くのにpnpm run buildでビルドしてdistディレクトリを開くと真っ白だった。

index.htmlで読み込むjavascriptファイルのパスがおかしかった。

解決策

vite.config.ts を編集する。

// https://vite.dev/config/
export default defineConfig({
  base: './',
  plugins: [react()],
})

base: './' を指定してやる。

OK

0
0
1

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?