Skip to content

Commit f27887c

Browse files
committed
first build
1 parent cddafaa commit f27887c

File tree

3 files changed

+1106
-19
lines changed

3 files changed

+1106
-19
lines changed

package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"repository": "https://github.com/coder/vscode-coder",
77
"version": "0.1.21",
88
"engines": {
9-
"vscode": "^1.73.0"
9+
"vscode": "^1.74.0"
1010
},
1111
"license": "MIT",
1212
"bugs": {
@@ -210,8 +210,10 @@
210210
"lint": "eslint . --ext ts,md",
211211
"lint:fix": "yarn lint --fix",
212212
"test": "vitest ./src",
213-
"test:ci": "CI=true yarn test"
213+
"test:ci": "CI=true yarn test",
214+
"open-in-browser": "vscode-test-web --extensionDevelopmentPath=. ."
214215
},
216+
"browser": "./dist/web/extension.js",
215217
"devDependencies": {
216218
"@types/eventsource": "^1.1.10",
217219
"@types/fs-extra": "^11.0.0",
@@ -224,6 +226,7 @@
224226
"@typescript-eslint/eslint-plugin": "^5.47.1",
225227
"@typescript-eslint/parser": "^4.14.1",
226228
"@vscode/test-electron": "^1.6.2",
229+
"@vscode/test-web": "*",
227230
"@vscode/vsce": "^2.16.0",
228231
"bufferutil": "^4.0.7",
229232
"coder": "https://github.com/coder/coder#main",
@@ -248,22 +251,33 @@
248251
"dependencies": {
249252
"@types/node-forge": "^1.3.4",
250253
"@types/ua-parser-js": "^0.7.36",
254+
"assert": "^2.0.0",
251255
"axios": "1.4.0",
256+
"browserify-zlib": "^0.2.0",
257+
"constants-browserify": "^1.0.0",
258+
"crypto-browserify": "^3.12.0",
252259
"date-fns": "^2.30.0",
253260
"eventsource": "^2.0.2",
254261
"find-process": "^1.4.7",
255262
"fs-extra": "^11.1.0",
263+
"https-browserify": "^1.0.0",
256264
"jsonc-parser": "^3.2.0",
257265
"memfs": "^3.4.13",
258266
"ndjson": "^2.0.0",
259267
"node-forge": "^1.3.1",
268+
"os-browserify": "^0.3.0",
269+
"path-browserify": "^1.0.1",
260270
"pretty-bytes": "^6.0.0",
261271
"semver": "^7.3.8",
272+
"stream-browserify": "^3.0.0",
273+
"stream-http": "^3.2.0",
262274
"tar-fs": "^2.1.1",
263275
"ua-parser-js": "^1.0.35",
276+
"url": "^0.11.1",
277+
"util": "^0.12.5",
264278
"which": "^2.0.2",
265279
"ws": "^8.11.0",
266280
"yaml": "^1.10.0",
267281
"zod": "^3.21.4"
268282
}
269-
}
283+
}

webpack.config.js

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,64 @@ const nodeConfig = {
4747
],
4848
},
4949
}
50-
module.exports = nodeConfig
50+
const webConfig = {
51+
target: "webworker", // web extensions run in a webworker context
52+
mode: "none", // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
53+
54+
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
55+
output: {
56+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
57+
path: path.resolve(__dirname, "dist"),
58+
filename: "extension.js",
59+
libraryTarget: "commonjs2",
60+
},
61+
devtool: "nosources-source-map",
62+
externals: {
63+
vscode: "commonjs vscode", // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
64+
},
65+
resolve: {
66+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
67+
extensions: [".ts", ".js"],
68+
// the Coder dependency uses absolute paths
69+
modules: ["./node_modules", "./node_modules/coder/site/src", "browser"],
70+
fallback: {
71+
"https": require.resolve("https-browserify"),
72+
"http": require.resolve("stream-http"),
73+
"util": require.resolve("util/"),
74+
"os": require.resolve("os-browserify/browser"),
75+
"path": require.resolve("path-browserify"),
76+
"url": require.resolve("url/"),
77+
"fs": false, // fs cannot be polyfilled, if it's essential, change your webpack target
78+
"child_process": false, // child_process can't be polyfilled
79+
"assert": require.resolve("assert/"),
80+
"stream": require.resolve("stream-browserify"),
81+
"constants": require.resolve("constants-browserify"),
82+
"crypto": require.resolve("crypto-browserify"),
83+
"zlib": require.resolve("browserify-zlib"),
84+
"tls": false,
85+
"net": false,
86+
"module": false,
87+
},
88+
},
89+
module: {
90+
rules: [
91+
{
92+
test: /\.ts$/,
93+
exclude: /node_modules\/(?!(coder).*)/,
94+
use: [
95+
{
96+
loader: "ts-loader",
97+
options: {
98+
allowTsInNodeModules: true,
99+
},
100+
},
101+
],
102+
},
103+
{
104+
test: /\.(sh|ps1)$/,
105+
type: "asset/source",
106+
},
107+
],
108+
},
109+
}
110+
module.exports = [nodeConfig, webConfig]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy