google / playground-elements

Serverless coding environments for the web.
BSD 3-Clause "New" or "Revised" License
534 stars 52 forks source link

Fix import of typescript module from typescript worker #413

Closed justinfagnani closed 4 weeks ago

justinfagnani commented 4 weeks ago

This moves the entrypoint of the typescript worker to the same relative location in the src/ tree that it is in the final output, so that any relative external paths in the output bundle point the the right place.

This fixes a problem where imports of ../internal/typescript.js were marked as external, and left in the worker bundle, but the bundle was output to one directory above where the entrypoint was in the source tree, meaning that import should be ./internal/typescript.js and the ../internal/typescript.js import was broken.

In order to have both a rollup input and rollup output at the same level, I needed to rename the input to add an -entrypoint suffix.