Less file import from node_modules doesn't work after building application

17 Views Asked by At

I want to overwrite some ant design styles. so I created less file which has imports like this:

@import "antd/es/style/themes/default.less";
@import "antd/dist/antd.less";

It works perfectly when I run npm start. but when building it doesn;t imports that two files.

vite config looks like this:

  css: {
    preprocessorOptions: {
      less: {
        math: "always",
        relativeUrls: true,
        javascriptEnabled: true,
      },
    },
  },

I've tried import from

@import "@node-modules/antd/es/style/themes/default.less"

but it can't find file. Somehow it works only when i'm importing

@import "antd/es/style/themes/default.less"

0

There are 0 best solutions below