Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match webpack sourcemap relative paths #1219

Merged
merged 2 commits into from
Nov 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: match webpack sourcemap relative paths
Adjust source path to match the way webpack generates sourcemaps
for js. This makes css and js sources appear in the same directory
when using sourcemaps in chrome.

Fixes #1218.
isaacl committed Nov 4, 2020
commit 00d2c2915bbaa27dcc2241188819fa06b0e8d022
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
@@ -484,7 +484,7 @@ function normalizeSourceMapForRuntime(map, loaderContext) {
path.relative(loaderContext.rootContext, absoluteSource)
);

return `webpack://${contextifyPath}`;
return `webpack://./${contextifyPath}`;
});
}

66 changes: 33 additions & 33 deletions test/__snapshots__/sourceMap-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ import ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \\"../../../src/runtime/cssWit
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/with-query.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\".foo {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/with-query.css\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\".foo {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -196,7 +196,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/with-query.css",
"webpack://./source-map/with-query.css",
],
"sourcesContent": Array [
".foo {
@@ -222,7 +222,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./test/fixtures/source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -242,7 +242,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://test/fixtures/source-map/nested/nested.css",
"webpack://./test/fixtures/source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -265,7 +265,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://test/fixtures/source-map/basic.css",
"webpack://./test/fixtures/source-map/basic.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
@@ -305,8 +305,8 @@ Object {
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack:///test/fixtures/source-map/nested/nested.css",
"webpack:///test/fixtures/source-map/basic.css",
"webpack:///./test/fixtures/source-map/nested/nested.css",
"webpack:///./test/fixtures/source-map/basic.css",
],
"sourcesContent": Array [
".nested {
@@ -348,8 +348,8 @@ Object {
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack:///source-map/nested/nested.css",
"webpack:///source-map/basic.css",
"webpack:///./source-map/nested/nested.css",
"webpack:///./source-map/basic.css",
],
"sourcesContent": Array [
".nested {
@@ -379,7 +379,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -399,7 +399,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.css",
"webpack://./source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -422,7 +422,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.css",
"webpack://./source-map/basic.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
@@ -450,7 +450,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic-1.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic-1.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -470,7 +470,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.css",
"webpack://./source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -493,7 +493,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic-1.css",
"webpack://./source-map/basic-1.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
@@ -519,7 +519,7 @@ import ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \\"../../../src/runtime/cssWit
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/base.less\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAAA;AAFF\\",\\"sourcesContent\\":[\\"@font-stack: Helvetica, sans-serif;\\\\n@primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% @font-stack;\\\\n color: @primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/base.less\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAAA;AAFF\\",\\"sourcesContent\\":[\\"@font-stack: Helvetica, sans-serif;\\\\n@primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% @font-stack;\\\\n color: @primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -540,7 +540,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/base.less",
"webpack://./source-map/base.less",
],
"sourcesContent": Array [
"@font-stack: Helvetica, sans-serif;
@@ -570,7 +570,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\":root {\\\\n --fontSize: 1rem;\\\\n --mainColor: rgba(18,52,86,0.47059);\\\\n --secondaryColor: rgba(102, 51, 153, 0.9);\\\\n}\\\\n\\\\nhtml {\\\\n overflow-x: hidden;\\\\n overflow-y: auto;\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (max-width: 50rem) {\\\\n body {\\\\n color: rgba(18,52,86,0.47059);\\\\n color: var(--mainColor);\\\\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;\\\\n font-size: 1rem;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(1rem * 1.5);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n word-wrap: break-word;\\\\n padding-left: calc(1rem / 2 + 1px);\\\\n padding-right: calc(1rem / 2 + 1px);\\\\n padding-left: calc(var(--fontSize) / 2 + 1px);\\\\n padding-right: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\nh1,h2,h3,h4,h5,h6 {\\\\n margin-top: 0;\\\\n margin-bottom: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgba(0, 0, 255, 0.9)\\\\n}\\\\n\\\\na:hover {\\\\n color: #639;\\\\n }\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.postcss.css\\"],\\"names\\":[],\\"mappings\\":\\"AAKA;EACE,gBAAgB;EAChB,mCAAsB;EACtB,yCAA4C;AAC9C;;AAEA;EACE,kBAAqB;EAArB,gBAAqB;EAArB,qBAAqB;AACvB;;AAEA;EACE;IACE,6BAAuB;IAAvB,uBAAuB;IACvB,iGAAsB;IACtB,eAA0B;IAA1B,0BAA0B;IAC1B,6BAAwC;IAAxC,wCAAwC;IACxC,qBAAyB;IACzB,kCAA+C;IAA/C,mCAA+C;IAA/C,6CAA+C;IAA/C,8CAA+C;EACjD;AACF;;AAEA;EACE,aAAe;EAAf,gBAAe;AACjB;;AAEA;EACE;AAKF;;AAHA;GACG,WAAoB;CACtB\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.postcss.css\\\\\\";\\\\n\\\\n@custom-media --viewport-medium (width <= 50rem);\\\\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\\\\n\\\\n:root {\\\\n --fontSize: 1rem;\\\\n --mainColor: #12345678;\\\\n --secondaryColor: lab(32.5 38.5 -47.6 / 90%);\\\\n}\\\\n\\\\nhtml {\\\\n overflow: hidden auto;\\\\n}\\\\n\\\\n@media (--viewport-medium) {\\\\n body {\\\\n color: var(--mainColor);\\\\n font-family: system-ui;\\\\n font-size: var(--fontSize);\\\\n line-height: calc(var(--fontSize) * 1.5);\\\\n overflow-wrap: break-word;\\\\n padding-inline: calc(var(--fontSize) / 2 + 1px);\\\\n }\\\\n}\\\\n\\\\n:--heading {\\\\n margin-block: 0;\\\\n}\\\\n\\\\na {\\\\n color: rgb(0 0 100% / 90%);\\\\n\\\\n&:hover {\\\\n color: rebeccapurple;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -590,7 +590,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.postcss.css",
"webpack://./source-map/nested/nested.postcss.css",
],
"sourcesContent": Array [
".nested {
@@ -651,7 +651,7 @@ a:hover {
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.postcss.css",
"webpack://./source-map/basic.postcss.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.postcss.css\\";
@@ -709,7 +709,7 @@ import ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \\"../../../src/runtime/cssWit
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;AAEhB\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 100% Helvetica, sans-serif;\\\\n color: #333;\\\\n}\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.scss\\"],\\"names\\":[],\\"mappings\\":\\"AAGA;EACE,gCAAA;EACA,WAJc;AAEhB\\",\\"sourcesContent\\":[\\"$font-stack: Helvetica, sans-serif;\\\\n$primary-color: #333;\\\\n\\\\nbody {\\\\n font: 100% $font-stack;\\\\n color: $primary-color;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -729,7 +729,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.scss",
"webpack://./source-map/basic.scss",
],
"sourcesContent": Array [
"$font-stack: Helvetica, sans-serif;
@@ -757,7 +757,7 @@ import ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \\"../../../src/runtime/cssWit
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 14px/1.5 Helvetica, arial, sans-serif;\\\\n}\\\\nbody #logo {\\\\n border-radius: 5px;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/base.styl\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,2CAAwB;AAC1B;AAAE;EACE,kBAAe;AAEnB\\",\\"sourcesContent\\":[\\"body {\\\\n font: 14px/1.5 Helvetica, arial, sans-serif;\\\\n #logo {\\\\n border-radius: 5px;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\"body {\\\\n font: 14px/1.5 Helvetica, arial, sans-serif;\\\\n}\\\\nbody #logo {\\\\n border-radius: 5px;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/base.styl\\"],\\"names\\":[],\\"mappings\\":\\"AAAA;EACE,2CAAwB;AAC1B;AAAE;EACE,kBAAe;AAEnB\\",\\"sourcesContent\\":[\\"body {\\\\n font: 14px/1.5 Helvetica, arial, sans-serif;\\\\n #logo {\\\\n border-radius: 5px;\\\\n }\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -780,7 +780,7 @@ body #logo {
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/base.styl",
"webpack://./source-map/base.styl",
],
"sourcesContent": Array [
"body {
@@ -809,7 +809,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -829,7 +829,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.css",
"webpack://./source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -852,7 +852,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.css",
"webpack://./source-map/basic.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
@@ -880,7 +880,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -900,7 +900,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.css",
"webpack://./source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -923,7 +923,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.css",
"webpack://./source-map/basic.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
@@ -951,7 +951,7 @@ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??[ident
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
___CSS_LOADER_EXPORT___.push([module.id, \\".class {\\\\n color: red;\\\\n}\\\\n\\", \\"\\",{\\"version\\":3,\\"sources\\":[\\"webpack://./source-map/basic.css\\"],\\"names\\":[],\\"mappings\\":\\"AAEA;EACE,UAAU;AACZ\\",\\"sourcesContent\\":[\\"@import \\\\\\"./nested/nested.css\\\\\\";\\\\n\\\\n.class {\\\\n color: red;\\\\n}\\\\n\\"],\\"sourceRoot\\":\\"\\"}]);
// Exports
export default ___CSS_LOADER_EXPORT___;
"
@@ -971,7 +971,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/nested/nested.css",
"webpack://./source-map/nested/nested.css",
],
"sourcesContent": Array [
".nested {
@@ -994,7 +994,7 @@ Array [
"names": Array [],
"sourceRoot": "",
"sources": Array [
"webpack://source-map/basic.css",
"webpack://./source-map/basic.css",
],
"sourcesContent": Array [
"@import \\"./nested/nested.css\\";
4 changes: 2 additions & 2 deletions test/sourceMap-option.test.js
Original file line number Diff line number Diff line change
@@ -501,7 +501,7 @@ describe('"sourceMap" option', () => {

expect(chunkName).toBe(
webpack.version[0] === '5'
? 'main.3106b4f9bed946cac826.bundle.js'
? 'main.81d6a28d012832093109.bundle.js'
: 'main.535d928b9abb27709302.bundle.js'
);
expect(
@@ -609,7 +609,7 @@ describe('"sourceMap" option', () => {

expect(chunkName).toBe(
// TODO still buggy on webpack@4
webpack.version[0] === '5' ? 'main.208dafd9be3442f7a927.css' : chunkName
webpack.version[0] === '5' ? 'main.0c4134a13ce273487b87.css' : chunkName
);

expect(