-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes the extension work on VSCode web (#72)
* Readme additions * Change alt * Bump package versions * Prettify the whole project * Make build work on web too * resolve "path" to path-browserify * Use prettier in standalone mode for the browser
- Loading branch information
Showing
6 changed files
with
68 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
(async () => { | ||
const ctx = await require('esbuild').context({ | ||
entryPoints: { | ||
extension: './src/extension.ts' | ||
}, | ||
bundle: true, | ||
outdir: './dist', | ||
external: ['vscode'], | ||
format: 'cjs', | ||
platform: 'node', | ||
tsconfig: './tsconfig.json', | ||
define: process.argv.includes('--production') ? { 'process.env.NODE_ENV': '"production"' } : undefined, | ||
minify: process.argv.includes('--production'), | ||
sourcemap: !process.argv.includes('--production'), | ||
}); | ||
if (process.argv.includes('--watch')) { | ||
await ctx.watch(); | ||
console.log('watching...'); | ||
} | ||
else { | ||
await ctx.rebuild(); | ||
await ctx.dispose(); | ||
} | ||
const ctx = await require("esbuild").context({ | ||
entryPoints: { | ||
extension: "./src/extension.ts", | ||
}, | ||
bundle: true, | ||
outdir: "./dist", | ||
external: ["vscode"], | ||
format: "cjs", | ||
inject: ["./scripts/process-shim.js"], | ||
tsconfig: "./tsconfig.json", | ||
define: process.argv.includes("--production") | ||
? { "process.env.NODE_ENV": '"production"' } | ||
: undefined, | ||
minify: process.argv.includes("--production"), | ||
sourcemap: !process.argv.includes("--production"), | ||
plugins: [ | ||
{ | ||
name: "node-deps", | ||
setup(build) { | ||
build.onResolve({ filter: /^path$/ }, (args) => { | ||
const path = require.resolve("../node_modules/path-browserify", { | ||
paths: [__dirname], | ||
}); | ||
return { path }; | ||
}); | ||
}, | ||
}, | ||
], | ||
}); | ||
if (process.argv.includes("--watch")) { | ||
await ctx.watch(); | ||
console.log("watching..."); | ||
} else { | ||
await ctx.rebuild(); | ||
await ctx.dispose(); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// https://esbuild.github.io/api/#inject | ||
|
||
let _cwd = "/"; | ||
|
||
export let process = { | ||
cwd: () => _cwd, | ||
chdir: (newCwd) => (_cwd = newCwd), | ||
env: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters