File tree 7 files changed +13
-9
lines changed 7 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
import * as cp from "child_process"
2
2
import * as path from "path"
3
+ import * as fs from "fs"
3
4
import browserify from "browserify"
4
5
5
6
async function main ( ) : Promise < void > {
@@ -164,6 +165,7 @@ class Watcher {
164
165
console . log ( "[plugin]" , original )
165
166
}
166
167
if ( line . includes ( "Watching for file changes" ) ) {
168
+ bundleBrowserCode ( browserFiles )
167
169
restartServer ( )
168
170
}
169
171
} )
@@ -174,12 +176,14 @@ class Watcher {
174
176
function bundleBrowserCode ( inputFiles : string [ ] ) {
175
177
console . log ( `[browser] bundling...` )
176
178
inputFiles . forEach ( async ( path : string ) => {
177
- browserify ( path )
179
+ const outputPath = path . replace ( ".js" , ".browserified.js" )
180
+ browserify ( )
178
181
. add ( path )
179
182
. bundle ( )
180
183
. on ( "error" , function ( error : Error ) {
181
184
console . error ( error . toString ( ) )
182
185
} )
186
+ . pipe ( fs . createWriteStream ( outputPath ) )
183
187
} )
184
188
console . log ( `[browser] done bundling` )
185
189
}
Original file line number Diff line number Diff line change @@ -30,6 +30,6 @@ <h2 class="header">{{ERROR_HEADER}}</h2>
30
30
</ div >
31
31
</ div >
32
32
</ 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 >
34
34
</ body >
35
35
</ html >
Original file line number Diff line number Diff line change @@ -49,6 +49,6 @@ <h1 class="main">Welcome to code-server</h1>
49
49
</ div >
50
50
</ div >
51
51
</ 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 >
54
54
</ html >
Original file line number Diff line number Diff line change 1
- import { getOptions } from "../../common/util.js "
1
+ import { getOptions } from "../../common/util"
2
2
3
3
const options = getOptions ( )
4
4
const el = document . getElementById ( "base" ) as HTMLInputElement
Original file line number Diff line number Diff line change 39
39
< body aria-label =""> </ body >
40
40
41
41
<!-- 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 >
44
44
< script data-cfasync ="false " type ="module " src ="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js "> </ script >
45
45
< script >
46
46
performance . mark ( "code/willLoadWorkbenchMain" )
Original file line number Diff line number Diff line change 1
- import { getOptions } from "../../common/util.js "
1
+ import { getOptions } from "../../common/util"
2
2
3
3
const options = getOptions ( )
4
4
Original file line number Diff line number Diff line change 1
1
import { logger } from "@coder/logger"
2
- import { getOptions , normalize , logError } from "../common/util.js "
2
+ import { getOptions , normalize , logError } from "../common/util"
3
3
4
4
export async function registerServiceWorker ( ) : Promise < void > {
5
5
const options = getOptions ( )
You can’t perform that action at this time.
0 commit comments