Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

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

Closed

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.

Activity

  1. micky2be commented on May 17, 2016

    @micky2be

    I noticed that too. Very annoying.
    I wonder if there is a work around.

  2. micky2be commented on May 17, 2016

    @micky2be

    Just figured out the problem comes from webpack itself
    See webpack/webpack#1466

  3. alexander-akait commented on Feb 13, 2018

    @alexander-akait
    Member

    Solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions