Skip to content

Commit

Permalink
Disable PostCSS sourcemaps.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgp1130 committed Jul 17, 2022
1 parent fffc7de commit 39a1fb6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
13 changes: 5 additions & 8 deletions packages/rules_prerender/css/css_binaries.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ load(":css_providers.bzl", "CssInfo")
def css_binaries(
name,
deps,
sourcemap = True,
testonly = None,
visibility = None,
tags = None,
Expand All @@ -23,14 +22,13 @@ def css_binaries(
"binary", a new CSS file which bundles all the `@import` dependencies of that source.
Returns:
`DefaultInfo`: Contains bundled CSS and sourcemaps.
`DefaultInfo`: Contains bundled CSS.
`CssImportMapInfo`: Maps importable paths to generated CSS binary files.
Args:
name: Name of this target.
deps: Dependencies of this target which provide `CssInfo` (generally
`css_library()`).
sourcemap: Whether to generate sourcemaps (defaults to `True`).
testonly: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
visibility: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
tags: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
Expand All @@ -40,7 +38,6 @@ def css_binaries(
binary_name = "%s_binary_%s" % (name, index)
_css_binary(
name = binary_name,
sourcemap = sourcemap,
dep = dep,
testonly = testonly,
tags = tags,
Expand All @@ -67,7 +64,6 @@ def css_binaries(
def _css_binary(
name,
dep,
sourcemap,
testonly = None,
visibility = None,
tags = None,
Expand All @@ -81,14 +77,13 @@ def _css_binary(
an independent "binary", meaning multiple binaries can be generated by this macro.
Returns:
`DefaultInfo`: Contains bundled CSS and sourcemaps.
`DefaultInfo`: Contains bundled CSS.
`CssImportMapInfo`: Maps importable paths to generated CSS binary files.
Args:
name: Name of this target.
dep: Dependency of this target which provides `CssInfo` (generally
`css_library()`).
sourcemap: Whether to generate sourcemaps.
testonly: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
visibility: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
tags: https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes
Expand All @@ -111,7 +106,9 @@ def _css_binary(
name = binary,
srcs = [dep],
output_pattern = "{name}",
sourcemap = sourcemap,
# Sourcemaps must be turned off because they don't work on Node.js versions v14+.
# https://github.com/bazelbuild/rules_postcss/issues/73/
sourcemap = False,
plugins = {
"//tools/internal:postcss_import_plugin": IMPORT_PLUGIN_CONFIG,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/rules_prerender/css/tests/dependencies/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ diff_test(

css_binaries(
name = "bin",
# Disable sourcemaps to not confuse `diff_test()` with an extra file.
sourcemap = False,
deps = [":foo"],
)

Expand Down
2 changes: 0 additions & 2 deletions packages/rules_prerender/css/tests/group/group_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def _css_group_test_impl(ctx):
default_info = analysistest.target_under_test(env)[DefaultInfo]
expected_files = sets.make([
"packages/rules_prerender/css/tests/group/lib1.css",
"packages/rules_prerender/css/tests/group/lib1.css.map",
"packages/rules_prerender/css/tests/group/lib2.css",
"packages/rules_prerender/css/tests/group/lib2.css.map",
])
actual_files = sets.make([file.short_path for file in default_info.files.to_list()])
asserts.new_set_equals(env, expected_files, actual_files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('prerender_component_publish_files()', () => {
'script_dep.js.map',
'script_dep.d.ts',
'style.css',
'style.css.map',
'component_resources', // from `resources` attribute.
]);

Expand Down

0 comments on commit 39a1fb6

Please sign in to comment.