Skip to content

Can not load css in antd #36

@Dcatfly

Description

@Dcatfly

version:

happypack@4.0.0, antd@2.13.11, webpack@2.7.0, ts-import-plugin@1.4.3

code:

  // {
  //   loader: "babel-loader",
  //   query: {
  //     presets: ["env", "react", "stage-0"],
  //     plugins:[
  //       ["import", { libraryName: "antd", style: "css" }],
  //       ["transform-runtime"],
  //     ],
  //   },
  // },
  {
    loader: "ts-loader",
    options: {
      // transpileOnly: true,
      happyPackMode: true,
      //这个组件暂时无效 不晓得是不是happypack的关系 而且纯用ts编译直出会导致一些问题 所以我还是选择babel
      getCustomTransformers: () => ({
        before: [ transformerFactory({
          libraryName: 'antd',
          // libraryDirectory: 'es',
          style: 'css',
        }) ]
      }),
    }
  }

describe:

Babel's import configuration is OK, replaced by TS import configuration will die, the compiler can pass but did not introduce css.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions