Skip to content

Commit

Permalink
make sure processor.ts exists in sourcemap
Browse files Browse the repository at this point in the history
  • Loading branch information
rnons committed Nov 13, 2024
1 parent 5674f8c commit 90e9800
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/esbuild/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ export async function runEsbuild(

await pluginContainer.buildStarted()
const esbuildPlugins: Array<EsbuildPlugin | false | undefined> = [
{
name: 'sentio-processor',
setup(build) {
// Make sure src/**/*.ts exists in sourcemap.
build.onLoad({ filter: /\/src\/(.+\/)*.+\.ts$/ }, async (args) => {
const content = await fs.promises.readFile(args.path, 'utf8')
return {
loader: 'ts',
contents:
content +
';import("node:process").then((p) => p.stdout.write(""));',
}
})
},
},
format === 'cjs' && options.removeNodeProtocol && nodeProtocolPlugin(),
{
name: 'modify-options',
Expand Down

0 comments on commit 90e9800

Please sign in to comment.