0
0

`[vite] Internal server error: [less] '~antd/es/style/themes/index.less' wasn't found.` の解決策

Posted at

React+vite環境でAnt Designを使おうとしていた。単にライブラリをインストールするだけだと、タイトル通りのエラーがでる。

以下のようにconfigurationを書いて解決した。

vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "~antd": path.resolve(__dirname, "node_modules/antd"),
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
});

あと less のインストールも必要だった。

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