ts-plugin / ts-plugin/ts-import-plugin

Can not load css in antd

Open
#36 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
TypeScript
Stars
603
Forks
36
Avg merge
1m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported ts-loader getCustomTransformers configuration and the TypeScript transformer entry point used with webpack 2.7.0. Reproduce the antd import using the listed versions, compare it with the working Babel configuration, and verify that the corresponding CSS is included in the build.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.