Skip to content

fix: comment out .less import to avoid requiring less preprocessor#2851

Open
lzxue wants to merge 1 commit into
masterfrom
fix/issue-2844-less-import
Open

fix: comment out .less import to avoid requiring less preprocessor#2851
lzxue wants to merge 1 commit into
masterfrom
fix/issue-2844-less-import

Conversation

@lzxue
Copy link
Copy Markdown
Contributor

@lzxue lzxue commented Apr 23, 2026

描述

修复 Issue #2844

问题

自 v2.24.0 起,@antv/l7-component/es/index.js 导入了 .less 源文件:

import "./css/index.less";

这会导致通过传递依赖(如 @ant-design/maps 或 @ant-design/charts)依赖 @antv/l7 的项目,在没有安装 less 作为开发依赖时构建失败。

修改内容

  • packages/component/src/index.ts: 注释掉 .less 导入,恢复 v2.23.x 的行为

测试

  • 本地构建通过
  • 需要在有 less 预处理器和无 less 预处理器两种环境下验证

Closes #2844

🤖 Generated with Claude Code

Fixes #2844

Since v2.24.0, @antv/l7-component/es/index.js imports .less source files,
breaking builds for projects that depend on @antv/l7 transitively without
having less installed as a dev dependency.

This fix comments out the less import to restore v2.23.x behavior.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

⚠️ No Changeset found

Latest commit: c142478

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request comments out the LESS style import in packages/component/src/index.ts to prevent consumers from being forced to install the LESS preprocessor. The reviewer suggests removing the commented-out code entirely to avoid zombie code and replacing it with a descriptive comment explaining that styles must be imported manually.

import './assets/iconfont/iconfont.js';
// 引入样式
import './css/index.less';
// import './css/index.less'; /* 注释掉以避免消费者必须安装 less */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议不要在代码中保留被注释掉的 import 语句(Zombie Code)。这会影响代码的整洁度和可维护性。既然决定不再通过这种方式引入样式,建议直接删除该行,或者将其替换为一段说明文字,告知开发者需要手动引入编译后的 CSS 文件。

Suggested change
// import './css/index.less'; /* 注释掉以避免消费者必须安装 less */
// 样式需由外部手动引入,避免强制消费者安装 less 预处理器

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@antv/l7-component ES build imports .less source files since v2.24.0, requiring consumers to install less preprocessor

2 participants