babel-plugin-component icon indicating copy to clipboard operation
babel-plugin-component copied to clipboard

js路径和css路径必须都是基于libDir的变量控制,能否分开

Open diandian18 opened this issue 6 years ago • 3 comments

能否使js路径基于/lib,而css/scss路径基于非lib的路径,比如packages,thx! 用于支持自定义主题的按需引入(引入变量方式) Converts

import { Button } from 'element-ui'

To

var button = require('element-ui/lib/button')
require('element-ui/packages/theme-chalk/src/button.scss')

diandian18 avatar Apr 10 '19 07:04 diandian18

相同的问题! 自定义主题的时候,会把lib下的css打包

light0x00 avatar Aug 10 '19 13:08 light0x00

我找到了解决方案,只需要像下面这样设置. 代码中正常导入自定义主题scss文件就好了

"plugins": [
    [
      "component",
      {
        "libraryName": "element-ui",
        "style":false
      }
    ]
  ]

light0x00 avatar Aug 10 '19 13:08 light0x00

试试在目录前加~

 [
    "component",
    {
    "libraryName": "element-ui",
    "styleLibraryName": "~node_modules/element-ui-theme/dist/theme"
    },
    ""
],

yolofit avatar Aug 03 '21 07:08 yolofit