vite和antd错误 - > [VITE:CSS]未启用内联JavaScript。您的选项是否设置?

发布于 2025-02-12 17:20:03 字数 2224 浏览 0 评论 0 原文

我不确定如何解决从CRA迁移到Vite的错误。

> vite build

vite v2.9.13 building for production...
✓ 3811 modules transformed.
[vite:css] Inline JavaScript is not enabled. Is it set in your options?
file: /Users/nikos/WebstormProjects/web/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/antd/es/date-picker/style/index.less:110:0
error during build:
Error: Inline JavaScript is not enabled. Is it set in your options?
    at less (/Users/nikos/WebstormProjects/web/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-80fe9c6b.js:38106:33)
    at async compileCSS (/Users/nikos/WebstormProjects/...

如果我将其添加到vite config,

  less: {
    javascriptEnabled: true,
  },

它将更改为

文件:/USERS/nikos/webstormprojects/web/node_modules/.pnpm/< data-cfemail =“ 0f617b6b4f3b213d3e213b”> [email&nbsp; pretanced] [email&nbsp; prectioned] [email&nbsp; procearted] /node_modules/antd/antd/antd/es/tag/tag/style/style/index.less:110:0:0 其中包含:

alt

I'm not sure how to around fixing this error that came about migrating from CRA to vite.

> vite build

vite v2.9.13 building for production...
✓ 3811 modules transformed.
[vite:css] Inline JavaScript is not enabled. Is it set in your options?
file: /Users/nikos/WebstormProjects/web/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/antd/es/date-picker/style/index.less:110:0
error during build:
Error: Inline JavaScript is not enabled. Is it set in your options?
    at less (/Users/nikos/WebstormProjects/web/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-80fe9c6b.js:38106:33)
    at async compileCSS (/Users/nikos/WebstormProjects/...

If I add this to Vite config

  less: {
    javascriptEnabled: true,
  },

It changes to

file: /Users/nikos/WebstormProjects/web/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/antd/es/tag/style/index.less:110:0
which contains:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

留一抹残留的笑 2025-02-19 17:20:03

将其添加到您的Vite配置

  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        additionalData: '@root-entry-name: default;',
      },
    },
  },

Add this to your vite config

  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        additionalData: '@root-entry-name: default;',
      },
    },
  },
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文