Home  >  Q&A  >  body text

javascript - Webpack issues about less dependencies

I have a common.less and a constant.less which are two common lesss.

Now, for example, if I write a pop-up box component in react, I need to introduce a demo.less.
demo.less depends on common.less and constant.less.

I will write another list component and need a list.less.
Also depends on common.less and constant.less

So I @import demo.less;@import list.less;

in list.less and demo.less respectively

In this way, when webpack uses less-loader, common.less and constant.less will be parsed on both sides and inserted into the head tag using style tags. It looks very painful. Please ask the experts if there is a better solution. ?

为情所困为情所困2732 days ago785

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 13:46:21

    When webpack is packaging, it will package all dependencies.. Wouldn’t it be better to only reference it in one place

    reply
    0
  • Cancelreply