Skip to content

Commit

Permalink
fix external example
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jun 30, 2024
1 parent 1d98156 commit 07b1501
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/content/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3976,24 +3976,25 @@ body:
- example:
cli:
- $: |
echo 'require("foo")' > app.js
echo 'import "foo"' > app.js
- $: |
esbuild app.js --bundle --external:foo
esbuild app.js --bundle --external:foo --format=esm
- expect: |
// app.js
require("foo");
import "foo";
mjs: |
import * as esbuild from 'esbuild'
import fs from 'node:fs'
fs.writeFileSync('app.js', 'require("foo")')
fs.writeFileSync('app.js', 'import "foo"')
await esbuild.build({
entryPoints: ['app.js'],
outfile: 'out.js',
bundle: true,
external: ['foo'],
format: 'esm',
})
go: |
Expand All @@ -4004,14 +4005,15 @@ body:
import "os"
func main() {
ioutil.WriteFile("app.js", []byte("require(\"foo\")"), 0644)
ioutil.WriteFile("app.js", []byte("import \"foo\""), 0644)
result := api.Build(api.BuildOptions{
EntryPoints: []string{"app.js"},
Outfile: "out.js",
Bundle: true,
Write: true,
External: []string{"foo"},
Format: api.FormatESModule,
})
if len(result.Errors) > 0 {
Expand Down

0 comments on commit 07b1501

Please sign in to comment.