Skip to content

Can't specify a full hostname as a root URL #236

Closed
@kmck

Description

@kmck

I'm trying to prepend a hostname to absolute URLs in my CSS (don't ask 😄) by doing something like this:

{
  loaders: [
    {
       test: /\.s?css$/,
       loader: 'css?root=http://some.cdn.com&sourceMap!postcss!sass?sourceMap',
    }
  ]
}

Doing this causes a bunch of errors because the // is being collapsed into a single /, resulting in URLs like http:/some.cdn.com/image.png in the compiled CSS, which look enough like relative paths to cause trouble and throw errors. I've discovered that using backslashes results in the absolute URLs I'm looking for, but that feels like a terrible hack that's just waiting to break at some point in the future.

I suspect this may be a problem deeper in the way query parameters are parsed in webpack, but I'd be happy with a solution or a cleaner workaround if anyone has ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions