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.

URL query params no longer parsed correctly with URL path in version 2.0.0+ #883

Description

@rishitank
  • Operating System: Mac OS X 10.14.2
  • Node Version: 10.10.0
  • NPM Version: 6.5.0
  • webpack Version: 4.26.1
  • css-loader Version: 2.1.0

Expected Behavior

When importing a library such as Bootstrap-sass or Font-awesome using SASS, these modules use query parameters in the URLs in order to extract specific styles. For example if I look in node_modules/font-awesome/css/font-awesome.css I see something like this:

@font-face {
  font-family: 'FontAwesome';
  src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

Actual Behavior

However when simply importing this module and setting the correct fa-font-path, it seems that css-loader is processing the query parameters incorrectly:

ERROR in ./src/containers/widgets/Calendar/assets/react/Calendar.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleParseError: Module parse failed: Unterminated string constant (5:134)
You may need an appropriate loader to handle this file type.
| var urlEscape = require("../../../../../../node_modules/css-loader/dist/runtime/url-escape.js");
| var ___CSS_LOADER_URL___0___ = urlEscape(require("bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot\""));
> var ___CSS_LOADER_URL___1___ = urlEscape(require("bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot") + "?#iefix"");
| var ___CSS_LOADER_URL___2___ = urlEscape(require("bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2\""));
| var ___CSS_LOADER_URL___3___ = urlEscape(require("bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.woff\""));
    at handleParseError (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/webpack/lib/NormalModule.js:447:19)
    at doBuild.err (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/webpack/lib/NormalModule.js:481:5)
    at runLoaders (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/webpack/lib/NormalModule.js:342:12)
    at /Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/loader-runner/lib/LoaderRunner.js:370:3
    at iterateNormalLoaders (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
    at iterateNormalLoaders (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
    at /Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/loader-runner/lib/LoaderRunner.js:233:3
    at context.callback (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at process.then.result (/Users/matchbyte/Documents/git/Matchbyte/Tigerair-WhiteKnight-Modules/node_modules/css-loader/dist/index.js:262:12)
 @ ./src/containers/widgets/Calendar/view/react/Calendar.jsx 38:0-42
 @ ./src/containers/widgets/Calendar/Calendar.react.jsx
 @ ./src/containers/containersBundle.react.js
 @ ./src/index.js
 @ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./config/polyfills.js ./src/index.js

Furthermore, it appears that in some cases the string passed to require terminates with \"" instead of "

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions