Closed haiting closed 1 year ago
Hello @haiting. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
Hi,
I'm getting the same warning.
I have "antd": "4.23.6" and "vite": "4.0.1"
I've updated all my imports to 'antd/es'
and 'antd/es/component'
I've created a simple vite app: https://github.com/alveshelio/vite-antD, Here in CodeSandbox but I'm unable to reproduce the same warnings. My app is quite big and is a private repo so I can't use it as a producible repo :(
*[vite] warning: /node_modules/.vite/deps/antd_lib_calendar_style.js 17 | default: () => default2 18 | }); 19 | import { default as default2 } from "/node_modules/antd/lib/calendar/style/index.less"; | ^ 20 | import as style_star from "/node_modules/antd/lib/calendar/style/index.less"; 21 | var init_style = __esm({ Default and named imports from CSS files are deprecated. Use the ?inline query instead. For example: import { default as default2 } from "/node_modules/antd/lib/calendar/style/index.less?inline" Plugin: vite:import-analysis File: /node_modules/.vite/deps/antd_lib_calendar_style.js?v=d665c8da 3:56:15 p.m. [vite] warning: /node_modules/.vite/deps/antd_lib_calendar_style.js 18 | }); 19 | import { default as default2 } from "/node_modules/antd/lib/calendar/style/index.less"; 20 | import as style_star from "/node_modules/antd/lib/calendar/style/index.less"; | ^ 21 | var init_style = __esm({ 22 | "vite:dep-pre-bundle:external-conversion:/node_modules/antd/lib/calendar/style/index.less"() { Default and named imports from CSS files are deprecated. Use the ?inline query instead. For example: import as style_star from "/node_modules/antd/lib/calendar/style/index.less?inline" Plugin: vite:import-analysis File: /node_modules/.vite/deps/antd_lib_calendar_style.js?v=d665c8da 3:56:15 p.m. [vite] warning: /node_modules/.vite/deps/antd_lib_calendar_style.js 30 | default: () => default3 31 | }); 32 | import { default as default3 } from "/node_modules/antd/lib/radio/style/index.less";**
This goes on for all of the components where AntD imports less files.
I can provide a reproduction example: https://github.com/froko/lit-tailwind-cypress-storybook In my case I'm using lit together with tailwind.
Here's the code which causes the warning:
import { adoptStyles, LitElement, unsafeCSS } from 'lit';
import style from './tailwind.css';
export class TwLitElement extends LitElement {
connectedCallback() {
super.connectedCallback();
if (this.shadowRoot) {
adoptStyles(this.shadowRoot, [unsafeCSS(style)]);
}
}
}
The following removes the warning for me:
declare module '*.scss?inline' {
import {CSSResult} from 'lit';
const styles: CSSResult;
export default styles;
}
import style from './tailwind.css?inline';
@oliveryasuna Thank you for your input. Your solution worked for me as well.
There is one addition I had to make in my project: import './tailwind.css';
in main.ts in order to get the fonts right.
Previously this was not required.
@froko
You're welcome. You'll probably get the same warning without appending ?inline
to your import.
Describe the bug
It will show below warning when I run
pnpm dev
:Reproduction
none
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Logs
No response
Validations