Skip to content

Commit

Permalink
fix: issues/1
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Nov 8, 2021
1 parent b9efcd1 commit f447efa
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 138 deletions.
39 changes: 39 additions & 0 deletions esbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { build } from 'esbuild';

// TODO 需要寻求更好的信息输出体验

build({
entryPoints: ['./src/index.ts'],
bundle: true,
outfile: './dist/index.js',
sourcemap: true,
watch: process.argv.includes('--watch')
? {
onRebuild(error, result) {
if (error != null) {
console.log('rebuild success', result);
} else {
console.log('rebuild failed', result);
}
},
}
: undefined,
plugins: [
{
// see https://github.com/evanw/esbuild/issues/1719
name: 'fix-node-html-parser',
setup(build) {
build.onResolve({ filter: /^node-html-parser$/ }, () => {
return { path: require.resolve('node-html-parser') };
});
},
},
],
})
.then((buildResult) => {
console.log('finished', buildResult);
})
.catch((error) => {
console.error(error);
process.exit(1);
});
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@
"description": "visit-counter",
"main": "dist/index.js",
"scripts": {
"build": "esbuild src/index.ts --bundle --outfile=dist/index.js --sourcemap",
"watch-esbuild": "esbuild src/index.ts --bundle --outfile=dist/index.js --sourcemap --watch",
"build": "ts-node esbuild.config.ts",
"watch-esbuild": "ts-node esbuild.config.ts --watch",
"watch-worker": "wrangler dev",
"start": "concurrently -k \"npm:watch-esbuild\" \"npm:watch-worker\"",
"publish": "wrangler publish"
},
"author": "lisonge",
"license": "ISC",
"license": "MIT",
"devDependencies": {
"@cloudflare/workers-types": "^2.2.2",
"@cloudflare/wrangler": "^1.19.3",
"@cloudflare/wrangler": "^1.19.4",
"@types/node": "^16.11.6",
"concurrently": "^6.3.0",
"esbuild": "^0.13.6",
"ts-node": "^10.3.0",
"esbuild": "^0.13.12",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
},
"dependencies": {
"eval5": "^1.4.6",
"node-html-parser": "^5.0.0",
"node-html-parser": "^5.1.0",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14"
}
Expand Down
Loading

0 comments on commit f447efa

Please sign in to comment.