Skip to content

Commit fe364ba

Browse files
committed
more wip
1 parent 1f35d7a commit fe364ba

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

ci/dev/watch.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cp from "child_process"
22
import * as path from "path"
3+
import * as fs from "fs"
34
import browserify from "browserify"
45

56
async function main(): Promise<void> {
@@ -164,6 +165,7 @@ class Watcher {
164165
console.log("[plugin]", original)
165166
}
166167
if (line.includes("Watching for file changes")) {
168+
bundleBrowserCode(browserFiles)
167169
restartServer()
168170
}
169171
})
@@ -174,12 +176,14 @@ class Watcher {
174176
function bundleBrowserCode(inputFiles: string[]) {
175177
console.log(`[browser] bundling...`)
176178
inputFiles.forEach(async (path: string) => {
177-
browserify(path)
179+
const outputPath = path.replace(".js", ".browserified.js")
180+
browserify()
178181
.add(path)
179182
.bundle()
180183
.on("error", function (error: Error) {
181184
console.error(error.toString())
182185
})
186+
.pipe(fs.createWriteStream(outputPath))
183187
})
184188
console.log(`[browser] done bundling`)
185189
}

src/browser/pages/error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ <h2 class="header">{{ERROR_HEADER}}</h2>
3030
</div>
3131
</div>
3232
</div>
33-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.js"></script>
33+
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
3434
</body>
3535
</html>

src/browser/pages/login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ <h1 class="main">Welcome to code-server</h1>
4949
</div>
5050
</div>
5151
</body>
52-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.js"></script>
53-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/login.js"></script>
52+
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
53+
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/login.browserified.js"></script>
5454
</html>

src/browser/pages/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getOptions } from "../../common/util.js"
1+
import { getOptions } from "../../common/util"
22

33
const options = getOptions()
44
const el = document.getElementById("base") as HTMLInputElement

src/browser/pages/vscode.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<body aria-label=""></body>
4040

4141
<!-- Startup (do not modify order of script tags!) -->
42-
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.js"></script>
43-
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.js"></script>
42+
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script>
43+
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/out/browser/register.browserified.js"></script>
4444
<script data-cfasync="false" type="module" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
4545
<script>
4646
performance.mark("code/willLoadWorkbenchMain")

src/browser/pages/vscode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getOptions } from "../../common/util.js"
1+
import { getOptions } from "../../common/util"
22

33
const options = getOptions()
44

src/browser/register.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logger } from "@coder/logger"
2-
import { getOptions, normalize, logError } from "../common/util.js"
2+
import { getOptions, normalize, logError } from "../common/util"
33

44
export async function registerServiceWorker(): Promise<void> {
55
const options = getOptions()

0 commit comments

Comments
 (0)