Skip to content

Commit 39a1fb6

Browse files
committed
Disable PostCSS sourcemaps.
Refs #46. This is blocking the Node.js upgrade past v12 and the feature doesn't really work anyways as it isn't currently linked properly in the output. See: bazelbuild/rules_postcss#73. Hopefully a future migration to Parcel will put us back in a position where CSS sourcemaps can be used.
1 parent fffc7de commit 39a1fb6

4 files changed

Lines changed: 5 additions & 13 deletions

File tree

packages/rules_prerender/css/css_binaries.bzl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ load(":css_providers.bzl", "CssInfo")
1212
def css_binaries(
1313
name,
1414
deps,
15-
sourcemap = True,
1615
testonly = None,
1716
visibility = None,
1817
tags = None,
@@ -23,14 +22,13 @@ def css_binaries(
2322
"binary", a new CSS file which bundles all the `@import` dependencies of that source.
2423
2524
Returns:
26-
`DefaultInfo`: Contains bundled CSS and sourcemaps.
25+
`DefaultInfo`: Contains bundled CSS.
2726
`CssImportMapInfo`: Maps importable paths to generated CSS binary files.
2827
2928
Args:
3029
name: Name of this target.
3130
deps: Dependencies of this target which provide `CssInfo` (generally
3231
`css_library()`).
33-
sourcemap: Whether to generate sourcemaps (defaults to `True`).
3432
testonly: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
3533
visibility: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
3634
tags: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
@@ -40,7 +38,6 @@ def css_binaries(
4038
binary_name = "%s_binary_%s" % (name, index)
4139
_css_binary(
4240
name = binary_name,
43-
sourcemap = sourcemap,
4441
dep = dep,
4542
testonly = testonly,
4643
tags = tags,
@@ -67,7 +64,6 @@ def css_binaries(
6764
def _css_binary(
6865
name,
6966
dep,
70-
sourcemap,
7167
testonly = None,
7268
visibility = None,
7369
tags = None,
@@ -81,14 +77,13 @@ def _css_binary(
8177
an independent "binary", meaning multiple binaries can be generated by this macro.
8278
8379
Returns:
84-
`DefaultInfo`: Contains bundled CSS and sourcemaps.
80+
`DefaultInfo`: Contains bundled CSS.
8581
`CssImportMapInfo`: Maps importable paths to generated CSS binary files.
8682
8783
Args:
8884
name: Name of this target.
8985
dep: Dependency of this target which provides `CssInfo` (generally
9086
`css_library()`).
91-
sourcemap: Whether to generate sourcemaps.
9287
testonly: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
9388
visibility: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
9489
tags: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
@@ -111,7 +106,9 @@ def _css_binary(
111106
name = binary,
112107
srcs = [dep],
113108
output_pattern = "{name}",
114-
sourcemap = sourcemap,
109+
# Sourcemaps must be turned off because they don't work on Node.js versions v14+.
110+
# https://github.com/bazelbuild/rules_postcss/issues/73/
111+
sourcemap = False,
115112
plugins = {
116113
"//tools/internal:postcss_import_plugin": IMPORT_PLUGIN_CONFIG,
117114
},

packages/rules_prerender/css/tests/dependencies/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ diff_test(
1212

1313
css_binaries(
1414
name = "bin",
15-
# Disable sourcemaps to not confuse `diff_test()` with an extra file.
16-
sourcemap = False,
1715
deps = [":foo"],
1816
)
1917

packages/rules_prerender/css/tests/group/group_test.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ def _css_group_test_impl(ctx):
1212
default_info = analysistest.target_under_test(env)[DefaultInfo]
1313
expected_files = sets.make([
1414
"packages/rules_prerender/css/tests/group/lib1.css",
15-
"packages/rules_prerender/css/tests/group/lib1.css.map",
1615
"packages/rules_prerender/css/tests/group/lib2.css",
17-
"packages/rules_prerender/css/tests/group/lib2.css.map",
1816
])
1917
actual_files = sets.make([file.short_path for file in default_info.files.to_list()])
2018
asserts.new_set_equals(env, expected_files, actual_files)

packages/rules_prerender/prerender_component_publish_files_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ describe('prerender_component_publish_files()', () => {
2323
'script_dep.js.map',
2424
'script_dep.d.ts',
2525
'style.css',
26-
'style.css.map',
2726
'component_resources', // from `resources` attribute.
2827
]);
2928

0 commit comments

Comments
 (0)