Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace webpack with esbuild. #1684

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ module Fable =
| Watch
| Clean

type Webpack =
| WithoutWebpack
| WithWebpack of args: string option

type Args =
{ Command: Command
Debug: bool
Expand All @@ -76,7 +72,7 @@ module Fable =
Defines: string list
SourceMaps: bool
AdditionalFableArgs: string option
Webpack: Webpack }
Bundle: bool }

let DefaultArgs =
{ Command = Build
Expand All @@ -87,7 +83,7 @@ module Fable =
Defines = []
AdditionalFableArgs = None
SourceMaps = true
Webpack = WithoutWebpack }
Bundle = false }

let private mkArgs args =
let fableCmd =
Expand Down Expand Up @@ -122,24 +118,11 @@ module Fable =

let fableAdditionalArgs = args.AdditionalFableArgs |> Option.defaultValue ""

let webpackCmd =
match args.Webpack with
| WithoutWebpack -> ""
| WithWebpack webpackArgs ->
sprintf
"--%s webpack %s %s %s"
(match args.Command with
| Watch -> "runWatch"
| _ -> "run")
(if args.Debug then
"--mode=development"
else
"--mode=production")
(if args.Experimental then
"--env.ionideExperimental"
else
"")
(webpackArgs |> Option.defaultValue "")
let bundleCmd =
if not args.Bundle then
""
else
"--run npm run esbuild"

let sourceMaps = if args.SourceMaps then "-s" else ""

Expand All @@ -154,7 +137,7 @@ module Fable =
fableExperimental
fableDefines
fableAdditionalArgs
webpackCmd
bundleCmd

let run args =
let cmd = mkArgs args
Expand Down Expand Up @@ -303,8 +286,7 @@ let initTargets () =
Fable.run
{ Fable.DefaultArgs with
Command = Fable.Watch
Debug = true
Webpack = Fable.WithWebpack None })
Debug = true })

Target.create "InstallVSCE" (fun _ ->
Process.killAllByName "npm"
Expand All @@ -319,14 +301,13 @@ let initTargets () =
{ Fable.DefaultArgs with
Command = Fable.Build
Debug = false
Webpack = Fable.WithWebpack None })
Bundle = true })

Target.create "RunDevScript" (fun _ ->
Fable.run
{ Fable.DefaultArgs with
Command = Fable.Build
Debug = true
Webpack = Fable.WithWebpack None })
Debug = true })


Target.create "CopyFSACNetcore" (fun _ ->
Expand Down Expand Up @@ -405,7 +386,8 @@ let buildTargetTree () =
"YarnInstall" ==>! "RunScript"
"DotNetRestore" ==>! "RunScript"

"Clean" ==> "Format" ==> "RunScript" ==>! "Default"
"Clean" ==> "Format" ==> "RunScript"
==>! "Default"

"Clean"
==> "RunScript"
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
{
"scripts": {
"gen:semver": "ts2fable node_modules/@types/semver/{classes,functions,internals,ranges}/*.d.ts node_modules/@types/semver/index.d.ts src/Imports/Semver.fs"
"gen:semver": "ts2fable node_modules/@types/semver/{classes,functions,internals,ranges}/*.d.ts node_modules/@types/semver/index.d.ts src/Imports/Semver.fs",
"esbuild-base": "esbuild ./out/fsharp.js --bundle --outfile=release/fsharp.js --external:vscode --format=cjs --platform=node",
"esbuild": "npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch"
},
"dependencies": {
"htmlparser2": "^4.1.0",
"semver": "^7.3.5"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@types/semver": "^7.3.8",
"@types/showdown": "^1.9.3",
"@types/vscode": "^1.52.0",
"@types/ws": "^7.2.6",
"axios": "^0.20.0",
"babel-loader": "^8.1.0",
"cross-spawn": "^7.0.3",
"esbuild": "^0.14.31",
"mocha": "^8.1.3",
"showdown": "^1.9.1",
"toml": "^3.0.0",
"ts2fable": "^0.8.0-build.618",
"vscode-debugadapter": "^1.44.0",
"vscode-languageclient": "^7.0.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"ws": "^7.3.1",
"xhr2": "^0.2.0"
},
"engines": {
"node": ">=14.0.0"
}
}
}
60 changes: 0 additions & 60 deletions webpack.config.js

This file was deleted.

Loading