What is the loader order for webpack?

前端 未结 3 1443
太阳男子
太阳男子 2020-12-02 06:26

When I have a loader configuration with multiple tests matching a file, I would expect only the first matching loader to be used but that doesn\'t seem to be the case.

3条回答
  •  感情败类
    2020-12-02 07:31

    {
        test: /\.css$/,
        loaders: ['style'],
    },
    {
        test: /\.css$/,
        loaders: ['css'],
    },
    

    and

    {
        test: /\.css$/,
        loaders: ['style', 'css'],
    },
    

    appear to be equal. In function terms, this is the same as style(css(file)) (thanks Miguel).

    Note that within loaders they are evaluated from right to left.

提交回复
热议问题