Skip to content

Conversation

@jgarber623
Copy link
Contributor

I encountered an interesting-to-me issue while experimenting with Eleventy and Cloudflare Pages Functions (see this toot).

In strict mode, interface is a reserved word. Or, at least will be a reserved word in the future. Something within Cloudflare's stack (esbuild, I suspect) is running in strict mode and threw this error:

  ✘ [ERROR] "interface" is a reserved word and cannot be used
  with the "esm" output format due to strict mode

Hunh. Well, TIL as they say.

This change uses destructuring to avoid use of interface in the filter and map callbacks. If destructuring isn't preferred, an alternative implementation could change the use of interface to iface or similar.

Thanks for considering this change!

In strict mode, `interface` is a reserved word. Or, at least _will_ be a reserved word in the future:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#future_reserved_words

This change uses destructuring to avoid use of `interface` in the `filter` and `map` callbacks.
@jgarber623
Copy link
Contributor Author

As it turns out, #96 is blocked by this since ECMAScript modules run in strict mode.

@zachleat
Copy link
Member

zachleat commented May 30, 2025

Related 11ty/eleventy#3836 (this work is already done but not yet pushed!)

@zachleat zachleat added this to the Eleventy Dev Server v3.0.0 milestone Jul 24, 2025
@zachleat zachleat merged commit 07befed into 11ty:main Jul 24, 2025
@zachleat
Copy link
Member

Shipping with Dev Server v3.0.0-alpha.1

Thank you so much!

@jgarber623 jgarber623 deleted the avoid-reserved-word-use branch July 25, 2025 00:29
@jgarber623
Copy link
Contributor Author

Thanks for the merge! 🙌🏻

@jgarber623 jgarber623 mentioned this pull request Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants