Tasveer Singh
Tasveer Singh

Reputation: 3

Referencing an external resource in a LESS file using WebPack

I need to @import an externally managed URL from LESS and am using WebPack but am unable to figure out how to do so.

Specifically, I need to @import a few URLs from myfonts.net in order to work with their licensing.

I am essentially doing the following: @import url("//myfonts.net");

But WebPack is looking for the file locally instead of importing the URL.

I believe the issue is with css-loader trying to resolve the file locally but I'm unsure how to indicate to css-loader to not resolve the URL at all.

Upvotes: 0

Views: 702

Answers (1)

zakjan
zakjan

Reputation: 2559

You can exclude files from loader config:

{ test: /\.css$/, exclude: /^(https?:)?\/\//, loader: 'style!css'},

Upvotes: 1

Related Questions