diff --git a/cli.go b/cli.go index ece7b4c..cdd9e86 100644 --- a/cli.go +++ b/cli.go @@ -159,6 +159,12 @@ func createCliApp() cli.App { Usage: "Will automatically deploy report to netlify", Destination: &netlifyToken, }, + &cli.BoolFlag{ + Name: "browser", + Usage: "Will use esbuild browser platform (by default it uses node platform)", + Value: false, + Destination: &globalConfig.BrowserPlatform, + }, } loadConfigFromFile() diff --git a/config.go b/config.go index 173f4e0..d39c794 100644 --- a/config.go +++ b/config.go @@ -13,7 +13,7 @@ import ( ) func getExternals() []string { - defaultExternals := []string{"path", "fs", "crypto", "os", "http", "child_process", "querystring", "readline", "tls", "assert", "buffer", "url", "net", "buffer", "tty", "util", "stream", "events", "zlib", "https", "worker_threads", "module", "http2", "dns"} + defaultExternals := []string{} cliExternals := externals.Value() @@ -34,6 +34,7 @@ type ConfigJSON struct { DevDependencies bool `json:"dev"` Externals []string `json:"externals"` IgnoredNamespaces []string `json:"ignore-namespaces"` + BrowserPlatform bool `json:"browser-platform"` } func setupConfig() { diff --git a/main.go b/main.go index 0afe0bd..29b3bd2 100644 --- a/main.go +++ b/main.go @@ -352,6 +352,12 @@ func depcheck() { setDeps(packageJsonPaths) + platform := api.PlatformNode + + if globalConfig.BrowserPlatform { + platform = api.PlatformBrowser + } + result := api.Build(api.BuildOptions{ EntryPoints: sourcePaths, // EntryPoints: []string{"test/monorepo/packages/package-b/src/App.tsx"}, @@ -363,6 +369,7 @@ func depcheck() { Plugins: []api.Plugin{depcheckPlugin}, External: getExternals(), Metafile: true, + Platform: platform, }) if len(result.Errors) > 0 { diff --git a/package.json b/package.json index 9cf73a1..f16bb4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "depp-installer", - "version": "0.0.8-ci-error-handling", + "version": "0.0.9", "description": " A fast unused and duplicate dependency checker ", "repository": { "type": "git",