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 1 year has passed since last update.

viteでlessをimportした際の inline JavaScript is not enabled. Is it set in your options? を解消する

Posted at

viteでAntDesignのテーマのカスタマイズを行おうとしたときに

inline JavaScript is not enabled. Is it set in your options?

というエラーが表示されました。

調べてみると preprocessorのオプションに javascriptEnabled: true を設定してあげないとダメそうです。

vite.config.js の設定変更

というわけで件の設定はviteでどうやってやるのって調べたら以下のように書けばいけるみたいでした

vite.config.js
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), tsconfigPaths()],
  server: {
    host: true,
  },
  // ↓を追加する
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
});
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?