Skip to content

Commit 8b60fc8

Browse files
authored
fix(CSS): sourcemap support for PostCSS files (#754)
* fix(CSS): sourcemap support * Create hip-spies-happen.md
1 parent 8142704 commit 8b60fc8

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.changeset/hip-spies-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'microbundle': patch
3+
---
4+
5+
Enable sourcemaps for CSS

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ function createConfig(options, entry, format, writeMeta) {
457457
// only write out CSS for the first bundle (avoids pointless extra files):
458458
inject: false,
459459
extract: !!writeMeta,
460+
sourceMap: options.sourcemap,
460461
}),
461462
moduleAliases.length > 0 &&
462463
alias({

test/__snapshots__/index.test.js.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ Directory tree:
433433
basic-css
434434
dist
435435
basic-css.css
436+
basic-css.css.map
436437
basic-css.esm.js
437438
basic-css.esm.js.map
438439
basic-css.js
@@ -454,9 +455,12 @@ Build \\"basicCss\\" to dist:
454455
134 B: basic-css.umd.js.br"
455456
`;
456457
457-
exports[`fixtures build basic-css with microbundle 2`] = `7`;
458+
exports[`fixtures build basic-css with microbundle 2`] = `8`;
458459
459-
exports[`fixtures build basic-css with microbundle 3`] = `"._rHGVB{display:flex;color:red;background:#00f}"`;
460+
exports[`fixtures build basic-css with microbundle 3`] = `
461+
"._rHGVB{display:flex;color:red;background:#00f}
462+
/*# sourceMappingURL=basic-css.css.map */"
463+
`;
460464
461465
exports[`fixtures build basic-css with microbundle 4`] = `
462466
"export default function(){var e=document.createElement(\\"div\\");return e.className=\\"testing\\",e}

0 commit comments

Comments
 (0)