Import CSS from “node_modules” in Webpack

后端 未结 3 485
遇见更好的自我
遇见更好的自我 2020-12-30 18:43

Some third-party modules I\'m using have their own CSS files. I\'d like to include them in my app\'s one, single CSS file, which is processed by Webpack. How can CSS files u

3条回答
  •  忘掉有多难
    2020-12-30 19:13

    If you are using too many things from one node_modules folder you can also create an alias by passing this following option

    options: {
        url: false,
        includePaths: [
            // this one for using node_modules as a base folder
            path.resolve('node_modules'),
            // this one for using sass as the base folder
            path.resolve('node_modules/flag-icon-css/sass')
        ]
    }
    

    After the configuration, you can import as you were trying in your question.

提交回复
热议问题