From 8a4b2d23fd27fd873ff5b5caf30d2b2d5882b4b4 Mon Sep 17 00:00:00 2001 From: lambdalisue Date: Thu, 21 Feb 2019 16:44:56 +0900 Subject: [PATCH] Use FuseBox instead of Parcel Because Parcel - Could not serve static files https://github.com/parcel-bundler/parcel/issues/1080 - Could not use native reload on HMR https://github.com/parcel-bundler/parcel/issues/289 --- fuse.js | 14 ++++++++++++++ index.html | 8 -------- package.json | 9 +++++---- src/{app.ts => index.ts} | 0 tsconfig.json | 3 +-- 5 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 fuse.js delete mode 100644 index.html rename src/{app.ts => index.ts} (100%) diff --git a/fuse.js b/fuse.js new file mode 100644 index 0000000..4e4d2a3 --- /dev/null +++ b/fuse.js @@ -0,0 +1,14 @@ +const { FuseBox, WebIndexPlugin } = require("fuse-box"); +const fuse = FuseBox.init({ + homeDir: "src", + target: "browser@es6", + output: "dist/$name.js", + plugins: [WebIndexPlugin()], +}); +fuse.dev(); // launch http server +fuse + .bundle("app") + .instructions(" > index.ts") + .hmr({ reload: true }) + .watch(); +fuse.run(); diff --git a/index.html b/index.html deleted file mode 100644 index e2dcd91..0000000 --- a/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - Hello World - - - - diff --git a/package.json b/package.json index 9f03cf6..9487cba 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,15 @@ "description": "A sandbox skeleton project for typescript in web browser.", "main": "lib/app.js", "scripts": { - "dev": "parcel index.html", - "build": "parcel build index.html" + "dev": "node fuse.js" }, "author": "lambdalisue", "license": "MIT", "dependencies": {}, "devDependencies": { - "parcel-bundler": "^1.11.0", - "typescript": "^3.3.3" + "fuse-box": "^3.7.1", + "terser": "^3.16.1", + "typescript": "^3.3.3", + "uglify-js": "^3.4.9" } } diff --git a/src/app.ts b/src/index.ts similarity index 100% rename from src/app.ts rename to src/index.ts diff --git a/tsconfig.json b/tsconfig.json index 0ea6aba..1aa28f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,8 +12,7 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCaseInSwitch": true + "noImplicitReturns": true }, "include": [ "src/**/*"