Skip to content

Commit 2bdc0a0

Browse files
petrbrzekclaude
andcommitted
Remove vite-plugin-top-level-await, use native TLA instead
The plugin's manual __tla promise-chaining broke examples that call createContainer() at module top level (vitest-demo, npm-scripts-demo). The createContainer chunk didn't propagate __tla, so PackageManager was still undefined when accessed. Native TLA (supported in all browsers since 2021) handles this correctly via the module system. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0d044f5 commit 2bdc0a0

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

vite.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'vite';
22
import { resolve } from 'path';
33
import wasm from 'vite-plugin-wasm';
4-
import topLevelAwait from 'vite-plugin-top-level-await';
4+
55

66
const isTest = process.env.VITEST === 'true';
77
export default defineConfig({
@@ -17,7 +17,6 @@ export default defineConfig({
1717
},
1818
plugins: isTest ? [] : [
1919
wasm(),
20-
topLevelAwait(),
2120
{
2221
name: 'browser-shims',
2322
enforce: 'pre',
@@ -68,6 +67,7 @@ export default defineConfig({
6867
format: 'es',
6968
},
7069
build: {
70+
target: 'esnext',
7171
commonjsOptions: {
7272
transformMixedEsModules: true,
7373
},

vite.lib.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { defineConfig } from 'vite';
22
import { resolve } from 'path';
33
import wasm from 'vite-plugin-wasm';
4-
import topLevelAwait from 'vite-plugin-top-level-await';
4+
55

66
export default defineConfig({
77
plugins: [
88
wasm(),
9-
topLevelAwait(),
109
{
1110
name: 'browser-shims',
1211
enforce: 'pre',
@@ -43,7 +42,6 @@ export default defineConfig({
4342
format: 'es',
4443
plugins: () => [
4544
wasm(),
46-
topLevelAwait(),
4745
],
4846
rollupOptions: {
4947
output: {

vite.sandbox.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'vite';
22
import { resolve } from 'path';
33
import wasm from 'vite-plugin-wasm';
4-
import topLevelAwait from 'vite-plugin-top-level-await';
4+
55

66
/**
77
* Vite config for the sandbox server.
@@ -12,7 +12,6 @@ import topLevelAwait from 'vite-plugin-top-level-await';
1212
export default defineConfig({
1313
plugins: [
1414
wasm(),
15-
topLevelAwait(),
1615
{
1716
name: 'browser-shims',
1817
enforce: 'pre',

0 commit comments

Comments
 (0)