Skip to content

Commit

Permalink
fix: remove --keep-names
Browse files Browse the repository at this point in the history
This option injects a `defineProperty` to existing function to keep its names for debugging purposes.
```js
function foo () {}
Object.defineProperty(foo, 'name', {value: 'foo'})
```
This however breaks older browsers since you cannot re-define a function name.
  • Loading branch information
longlho authored and alexeagle committed Feb 23, 2021
1 parent 9506fe0 commit 4a26898
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/esbuild/esbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def _esbuild_impl(ctx):

args.add("--bundle", entry_point.path)
args.add("--sourcemap")
args.add("--keep-names")
args.add("--preserve-symlinks")
args.add_joined(["--platform", ctx.attr.platform], join_with = "=")
args.add_joined(["--target", ctx.attr.target], join_with = "=")
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/alias-mapping/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("//packages/esbuild/test:tests.bzl", "esbuild")

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "main.js",
format = "esm",
deps = [
Expand Down
3 changes: 3 additions & 0 deletions packages/esbuild/test/bundle/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "a.ts",
deps = [":lib"],
)

esbuild(
name = "bundle.min",
args = ["--keep-names"],
entry_point = "a.ts",
minify = True,
deps = [":lib"],
)

esbuild(
name = "bundle.split",
args = ["--keep-names"],
entry_point = "a.ts",
output_dir = True,
deps = [":lib"],
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/define/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
define = [
"process.env.NODE_ENV=\"defined_in_bundle\"",
],
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/external-flag/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "main.ts",
external = [
"fs",
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/splitting/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "main.ts",
output_dir = True,
deps = [":main"],
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/typescript/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "main.ts",
format = "esm",
deps = [":main"],
Expand Down
1 change: 1 addition & 0 deletions packages/esbuild/test/workspace-mapping/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("//packages/esbuild/test:tests.bzl", "esbuild")

esbuild(
name = "bundle",
args = ["--keep-names"],
entry_point = "main.js",
format = "esm",
link_workspace_root = True,
Expand Down

0 comments on commit 4a26898

Please sign in to comment.