Switch to pure esbuild from esbuild-loader

This commit is contained in:
Oliver Blanthorn 2021-04-10 22:43:00 +02:00
parent 1501ea4513
commit 3c35f54c5e
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
5 changed files with 29 additions and 38 deletions

View file

@ -2,13 +2,22 @@
"name": "tridactyl",
"version": "0.1.0",
"description": "Vimperator/Pentadactyl successor",
"browser": {
"url": false,
"fs": false,
"https": false,
"http": false,
"path": false,
"timers": false,
"stream": "stream-browserify"
},
"dependencies": {
"@types/css": "0.0.31",
"@types/nearley": "^2.11.1",
"command-line-args": "^5.1.1",
"csp-serdes": "github:cmcaine/csp-serdes",
"css": "^3.0.0",
"esbuild-loader": "^2.11.0",
"esbuild": "^0.11.7",
"fuse.js": "^6.4.6",
"jasmine-fail-fast": "^2.0.1",
"mark.js": "^8.11.1",

View file

@ -73,7 +73,7 @@ if [ "$QUICK_BUILD" != "1" ]; then
else
echo "Warning: dirty rebuild. Skipping docs, metadata and type checking..."
webpack --stats errors-only --bail --env quick
node scripts/esbuild.js
fi

10
scripts/esbuild.js Normal file
View file

@ -0,0 +1,10 @@
const esbuild = require('esbuild')
for (let f of ["content", "background", "help", "newtab", "commandline_frame"]) {
esbuild.build({
entryPoints: [`src/${f}.ts`],
bundle: true,
target: "firefox68",
outfile: `build/${f}.js`,
}).catch(() => process.exit(1))
}

View file

@ -13,6 +13,7 @@ module.exports = function(env, argv) {
devtool: "source-map",
// devtool: "inline-source-map", // Uncomment me for more helpful error messages
// NB: duplicate these files in scripts/esbuild.js
entry: {
background: "./src/background.ts",
content: "./src/content.ts",
@ -30,6 +31,8 @@ module.exports = function(env, argv) {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: fileExtensions,
plugins: [new TsconfigPathsPlugin({extensions: fileExtensions})],
// NB: items below also need to be added to the package.json "browser" field
// or quick builds won't work
fallback: {
"url": false,
"fs": false,
@ -43,8 +46,6 @@ module.exports = function(env, argv) {
module: {
rules: [
// Quick builds use esbuild, everything else uses `tsc`
env.quick ? { test: /\.ts?$/, loader: "esbuild-loader", options: { loader: "ts", target: "firefox68" } } :
{ test: /\.ts?$/, loader: "ts-loader" },
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.

View file

@ -2592,22 +2592,10 @@ es6-promisify@6.1.1:
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.1.1.tgz#46837651b7b06bf6fff893d03f29393668d01621"
integrity sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==
esbuild-loader@^2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.11.0.tgz#65efc9c8ab14f2da06b9d165396f9520b4aeac96"
integrity sha512-yFzrpIvhHRtV1Z8V1VtW6xm0dmEHlBheJjhx+EJPTcSKBhVMeIKC2FVyZ+N1ZgSBZEKgky9vtD4q455HgnT/3g==
dependencies:
esbuild "^0.10.2"
joycon "^3.0.1"
json5 "^2.2.0"
loader-utils "^2.0.0"
type-fest "^1.0.1"
webpack-sources "^2.2.0"
esbuild@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.10.2.tgz#caa65a8f3096d547d89159918039df6c5c6c90be"
integrity sha512-/5vsZD7wTJJHC3yNXLUjXNvUDwqwNoIMvFvLd9tcDQ9el5l13pspYm3yufavjIeYvNtAbo+6N/6uoWx9dGA6ug==
esbuild@^0.11.7:
version "0.11.7"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.7.tgz#c32ee844d3b0db489e62ea0ad028e109f6f205c7"
integrity sha512-rY+jA0TiCFVLcvxUbbp+yQ9EEBXDsfIU4rsY7RKJEsx/fjjRFjyGnamRCBwUZQspK37G9We6xAkX7IibGA24AA==
escalade@^3.1.1:
version "3.1.1"
@ -4460,11 +4448,6 @@ jest@^25.5.4:
import-local "^3.0.2"
jest-cli "^25.5.4"
joycon@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf"
integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA==
js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@ -4588,13 +4571,6 @@ json5@^2.1.2:
dependencies:
minimist "^1.2.5"
json5@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
dependencies:
minimist "^1.2.5"
jsonfile@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
@ -7291,11 +7267,6 @@ type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
type-fest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.0.1.tgz#2494455e65c59170ec98bdda05b7d7184f5b74ad"
integrity sha512-+UTPE7JT3O+sUpRroRgQAbbSfIRBwOHh+o/oruB1JJE6g6uBm3Y0D82fO3xu8VHfxJLQjeRp0PEY6mRmh/lElA==
typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
@ -7616,7 +7587,7 @@ webpack-merge@^5.7.3:
clone-deep "^4.0.1"
wildcard "^2.0.0"
webpack-sources@^2.1.1, webpack-sources@^2.2.0:
webpack-sources@^2.1.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.2.0.tgz#058926f39e3d443193b6c31547229806ffd02bac"
integrity sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w==