Replies: 1 comment 1 reply
-
At present, I have a similar problem. Source code components/style.ts import './header/style' components/header/style/index.ts import './index.less' components/header/style/index.less .test {
color: red;
} After compiling the code components/style.js import './header/style/index.less' // What I expect is import'. /header/style' components/header/style/index.js (This file does not exist and I need to keep it so that I can import "/components/header/style" directly when I use it externally.) components/header/style/index.less .test {
color: red;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone! I have React component library (TS + less) in monorepo (NPM Workspaces + lerna). Currently it is built by tsc and use post-build script that copy less files to build directory. I'm trying to build this library with vite in library mode, and TS files are compiled, but styles are injected into JS-file and class attributes in DOM are lost (though they are presented in JS). I reproduced it with projects that are served as by Webpack as by Vite. So I want to try prevent styles from compiling (so JS files will still use .less instead of inlined js) and copy less to build directory, may be it will help me to solve this problem. How can I do it? Making '.less' files external or excluded does not help (JS file refer to .less.js after build, even though TS files referred to .less);
There is my vite.config.js:
Beta Was this translation helpful? Give feedback.
All reactions