I am trying to make a chrome extension with esbuild and ts react with a build file that looks something like this.
require('esbuild')
.build({
entryPoints: [
'src/contentScript.ts',
'src/index.html',
],
outdir: 'dist',
bundle: true,
platform: 'browser',
banner: {
js: `var regeneratorRuntime;`,
}
})
.catch(() => process.exit(1));
When I build my project, the transpiled code contains the following:
Script.prototype.runInThisContext = function() {
return eval(this.code);
}
The use of eval is unacceptable for a chrome extension due to security concerns. So how do I configure esbuild to NOT use eval
? I saw a GitHub issue of a similar problem but adding banner: { js:
var regeneratorRuntime;, },
did not stop esbuild from using eval. Please help!