Skip to content

Commit

Permalink
fix: bundle code to ES5 with babel
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Jun 18, 2024
1 parent 6058cfd commit bf9b9f6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion actions/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ func (a *BuildAction) Run(ctx context.Context) error {
}
defer os.RemoveAll(webpackOutputDir)

fmt.Println("============================================================")
fmt.Println("Targeting JavaScript code to ES5 using Babel")
fmt.Println("============================================================")

// Build the local directory
cmd = a.Project.CommandContext(ctx, "npx", "babel", filepath.Join(webpackOutputDir, "bundle.js"), "--out-file", filepath.Join(webpackOutputDir, "bundle-es5.js"), "--presets", "babel-preset-es2015")
if err := cmd.Run(); err != nil {
return err
}
defer os.RemoveAll(webpackOutputDir)

fmt.Println()

fmt.Println("============================================================")
Expand Down Expand Up @@ -78,7 +89,7 @@ func (a *BuildAction) Run(ctx context.Context) error {
defer file.Close()

// Create a reader for the plugin source code
pluginCode, err := os.Open(filepath.Join(webpackOutputDir, "bundle.js"))
pluginCode, err := os.Open(filepath.Join(webpackOutputDir, "bundle-es5.js"))
if err != nil {
return err
}
Expand Down

0 comments on commit bf9b9f6

Please sign in to comment.