Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vitePluginForArco 设置 style 为 false 的时候 不会按需导入组件了 #107

Open
1 task
mtrucc opened this issue Jun 10, 2023 · 3 comments
Open
1 task

Comments

@mtrucc
Copy link

mtrucc commented Jun 10, 2023

Basic Info

Extra info

使用 https://arco.design/vue/docs/pro/start 快速创建 vue 版本
修改 config/plugin/arcoStyleImport.ts 文件

export default function configArcoStyleImportPlugin() {
  const arcoResolverPlugin = vitePluginForArco({
    style: false,
  });
  return arcoResolverPlugin;
}

What is expected?

设置 style 为 false 的时候,按需导入组件,但不导入对应样式。

Steps to reproduce

export default function configArcoStyleImportPlugin() {
  const arcoResolverPlugin = vitePluginForArco({
    style: false,
  });
  return arcoResolverPlugin;
}
@mtrucc
Copy link
Author

mtrucc commented Jun 10, 2023

https://github.com/arco-design/arco-plugins/blob/3a092eea4307b17cfdc2ab091906d6ab60a7f43e/packages/plugin-vite-vue/src/arco-design-plugin/transform.ts#L68

  if (style === false || !/\.(js|jsx|ts|tsx|vue)$/.test(id)) {
    return undefined;
  }

这种判断方式是不是有问题?

@CarlisleCullen
Copy link

问题解决了么?现在设置 style 为 false 的时候,依旧会导入对应样式。

@mtrucc
Copy link
Author

mtrucc commented Jan 10, 2025

问题解决了么?现在设置 style 为 false 的时候,依旧会导入对应样式。

自己重写一下插件 修改一下这个判断

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants