prime8dev

prime8dev
git clone https://git.prime8.dev/prime8dev.git
Log | Files | Refs | README | LICENSE

main.go (648B)


      1 package main
      2 
      3 import (
      4 	"fmt"
      5 	"os"
      6 
      7 	"github.com/evanw/esbuild/pkg/api"
      8 )
      9 
     10 func main() {
     11 	result := api.Build(api.BuildOptions{
     12 		EntryPoints:       []string{"internal/web/scripts/app.js"},
     13 		Outfile:           "static/app.js",
     14 		Bundle:            true,
     15 		MinifyWhitespace:  true,
     16 		MinifySyntax:      true,
     17 		MinifyIdentifiers: false,
     18 		Target:            api.ES2020,
     19 		Format:            api.FormatIIFE,
     20 		Platform:          api.PlatformBrowser,
     21 		Write:             true,
     22 		LogLevel:          api.LogLevelInfo,
     23 	})
     24 
     25 	if len(result.Errors) > 0 {
     26 		fmt.Fprintf(os.Stderr, "esbuild failed with %d errors\n", len(result.Errors))
     27 		os.Exit(1)
     28 	}
     29 }