Fix __publicField error with esnext esbuild target

maplibre-gl v5 bundles reference __publicField and other esbuild
class-field helpers without defining them — a known upstream bug
(maplibre-gl-js issue #6680). Setting esbuildOptions.target and
build.target to 'esnext' tells esbuild to emit native class fields
instead of helper-based transforms, eliminating the missing symbol.

Remove all previous workaround attempts (define rewrite, globalThis
polyfill in index.html).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Pupius
2026-03-16 00:04:23 +00:00
parent 38798de9ca
commit 5242622107
2 changed files with 12 additions and 14 deletions
-7
View File
@@ -15,13 +15,6 @@
<body>
<div id="root"></div>
<script>
globalThis.__publicField = function(obj, key, value) {
Object.defineProperty(obj, typeof key !== 'symbol' ? key + '' : key, {
configurable: true, enumerable: true, writable: true, value: value
});
};
</script>
<script type="module" src="/src/main.tsx"></script>
</body>