Skip to content

Commit 1d2979f

Browse files
committed
Fix extra CSS being included on the client
1 parent 026dc2a commit 1d2979f

16 files changed

+279
-289
lines changed

build/tasks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const buildServerBinaryPackage = register("build:server:binary:package", async (
2828
const cliPath = path.join(pkgsPath, "server");
2929
runner.cwd = cliPath;
3030
if (!fs.existsSync(path.join(cliPath, "out"))) {
31-
throw new Error("Cannot build binary without web bundle built");
31+
throw new Error("Cannot build binary without server bundle built");
3232
}
3333
await buildServerBinaryCopy();
3434
await dependencyNexeBinary();
@@ -78,7 +78,7 @@ const buildServerBinaryCopy = register("build:server:binary:copy", async (runner
7878
const cliBuildPath = path.join(cliPath, "build");
7979
fse.removeSync(cliBuildPath);
8080
fse.mkdirpSync(path.join(cliBuildPath, "extensions"));
81-
const bootstrapForkPath = path.join(pkgsPath, "vscode", "bin", "bootstrap-fork.js");
81+
const bootstrapForkPath = path.join(pkgsPath, "vscode", "out", "bootstrap-fork.js");
8282
const webOutputPath = path.join(pkgsPath, "web", "out");
8383
const browserAppOutputPath = path.join(pkgsPath, "app", "browser", "out");
8484
const nodePtyModule = path.join(pkgsPath, "protocol", "node_modules", "node-pty", "build", "Release", "pty.node");
@@ -124,7 +124,7 @@ const buildServerBinaryCopy = register("build:server:binary:copy", async (runner
124124
const buildServerBundle = register("build:server:bundle", async (runner) => {
125125
const cliPath = path.join(pkgsPath, "server");
126126
runner.cwd = cliPath;
127-
await runner.execute("npm", ["run", "build:webpack"]);
127+
await runner.execute("npm", ["run", "build"]);
128128
});
129129

130130
const buildBootstrapFork = register("build:bootstrap-fork", async (runner) => {

packages/app/browser/webpack.config.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,16 @@ const path = require("path");
22
const webpack = require("webpack");
33
const merge = require("webpack-merge");
44
const HtmlWebpackPlugin = require("html-webpack-plugin");
5-
const prod = process.env.NODE_ENV === "production";
65

7-
module.exports = merge(require(path.join(__dirname, "../../../scripts", "webpack.general.config.js"))(), {
8-
devtool: prod ? "source-map" : "cheap-module-eval-source-map",
9-
mode: prod ? "production" : "development",
10-
output: {
11-
path: path.join(__dirname, "out"),
6+
const root = path.resolve(__dirname, "../../..");
7+
8+
module.exports = merge(
9+
require(path.join(root, "scripts/webpack.client.config.js"))({
10+
entry: path.join(root, "packages/app/browser/src/app.ts"),
11+
template: path.join(root, "packages/app/browser/src/app.html"),
12+
}), {
13+
output: {
14+
path: path.join(__dirname, "out"),
15+
},
1216
},
13-
entry: [
14-
"webpack-hot-middleware/client?reload=true&quiet=true",
15-
"./packages/app/browser/src/app.ts"
16-
],
17-
plugins: [
18-
new HtmlWebpackPlugin({
19-
template: "packages/app/browser/src/app.html",
20-
}),
21-
new webpack.HotModuleReplacementPlugin(),
22-
// new BundleAnalyzerPlugin(),
23-
]
24-
});
17+
);

packages/dns/webpack.config.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
const path = require("path");
22
const merge = require("webpack-merge");
33

4-
module.exports = merge(require(path.join(__dirname, "../../scripts", "webpack.general.config.js"))(), {
5-
devtool: "none",
6-
mode: "production",
7-
target: "node",
8-
externals: {
9-
"node-named": "commonjs node-named",
10-
},
11-
output: {
12-
path: path.join(__dirname, "out"),
13-
filename: "main.js",
4+
const root = path.resolve(__dirname, "../..");
5+
6+
module.exports = merge(
7+
require(path.join(root, "scripts/webpack.node.config.js"))({
8+
// Options.
9+
}), {
10+
externals: {
11+
"node-named": "commonjs node-named",
12+
},
13+
output: {
14+
path: path.join(__dirname, "out"),
15+
filename: "main.js",
16+
},
17+
entry: [
18+
"./packages/dns/src/dns.ts"
19+
],
1420
},
15-
entry: [
16-
"./packages/dns/src/dns.ts"
17-
],
18-
});
21+
);

packages/ide-api/yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+

packages/server/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
"files": [],
66
"scripts": {
77
"start": "node --max-old-space-size=32384 --require ts-node/register --require tsconfig-paths/register src/cli.ts",
8-
"build:webpack": "rm -rf ./out && export CLI=true && UV_THREADPOOL_SIZE=100 node --max-old-space-size=32384 ../../node_modules/webpack/bin/webpack.js --config ./webpack.config.js",
9-
"build:nexe": "node scripts/nexe.js",
10-
"build:bootstrap-fork": "cd ../vscode && npm run build:bootstrap-fork; mkdir -p ./packages/server/resources; cp ./bin/bootstrap-fork.js ../server/resources/bootstrap-fork.js",
11-
"build:default-extensions": "cd ../../lib/vscode && npx gulp vscode-linux-arm && cd ../.. && mkdir -p ./packages/server/resources/extensions; cp -r ./lib/VSCode-linux-arm/resources/app/extensions/* ./packages/server/resources/extensions/",
12-
"build:web": "cd ../web; rm -rf ./out; NODE_ENV=production npm run build; rm -rf ../server/resources/web; mkdir -p ../server/resources/web; cp -r ./out/* ../server/resources/web",
13-
"build": "npm run build:bootstrap-fork && npm run build:webpack && npm run build:nexe"
8+
"build": "rm -rf ./out && export CLI=true && UV_THREADPOOL_SIZE=100 node --max-old-space-size=32384 ../../node_modules/webpack/bin/webpack.js --config ./webpack.config.js",
9+
"build:nexe": "node scripts/nexe.js"
1410
},
1511
"dependencies": {
1612
"@oclif/config": "^1.10.4",

packages/server/src/vscode/bootstrapFork.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const requireModule = (modulePath: string, dataDir: string, builtInExtens
110110
if (isCli) {
111111
content = zlib.gunzipSync(readFile("bootstrap-fork.js.gz"));
112112
} else {
113-
content = readFile("../../vscode/bin/bootstrap-fork.js");
113+
content = readFile("../../vscode/out/bootstrap-fork.js");
114114
}
115115
eval(content.toString());
116116
};

packages/server/webpack.config.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,33 @@ const path = require("path");
22
const webpack = require("webpack");
33
const merge = require("webpack-merge");
44

5-
module.exports = merge({
6-
devtool: "none",
7-
mode: "production",
8-
output: {
9-
filename: "cli.js",
10-
path: path.join(__dirname, "./out"),
11-
libraryTarget: "commonjs",
12-
},
13-
node: {
14-
console: false,
15-
global: false,
16-
process: false,
17-
Buffer: false,
18-
__filename: false,
19-
__dirname: false,
20-
setImmediate: false
5+
const root = path.resolve(__dirname, "../..");
6+
7+
module.exports = merge(
8+
require(path.join(root, "scripts/webpack.node.config.js"))({
9+
// Config options.
10+
}), {
11+
output: {
12+
filename: "cli.js",
13+
path: path.join(__dirname, "out"),
14+
libraryTarget: "commonjs",
15+
},
16+
node: {
17+
console: false,
18+
global: false,
19+
process: false,
20+
Buffer: false,
21+
__filename: false,
22+
__dirname: false,
23+
setImmediate: false
24+
},
25+
externals: ["tslib", "trash"],
26+
entry: "./packages/server/src/cli.ts",
27+
plugins: [
28+
new webpack.DefinePlugin({
29+
"process.env.BUILD_DIR": `"${__dirname}"`,
30+
"process.env.CLI": `"${process.env.CLI ? "true" : "false"}"`,
31+
}),
32+
],
2133
},
22-
externals: ["tslib", "trash"],
23-
entry: "./packages/server/src/cli.ts",
24-
target: "node",
25-
plugins: [
26-
new webpack.DefinePlugin({
27-
"process.env.BUILD_DIR": `"${__dirname}"`,
28-
"process.env.CLI": `"${process.env.CLI ? "true" : "false"}"`,
29-
}),
30-
],
31-
}, require("../../scripts/webpack.general.config")());
34+
);

packages/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "VS Code implementation of the browser-based IDE client.",
44
"main": "src/index.ts",
55
"scripts": {
6-
"build:bootstrap-fork": "../../node_modules/.bin/webpack --config ./webpack.config.bootstrap.js"
6+
"build:bootstrap-fork": "UV_THREADPOOL_SIZE=100 node --max-old-space-size=32384 ../../node_modules/webpack/bin/webpack.js --config ./webpack.bootstrap.config.js"
77
},
88
"dependencies": {
99
"iconv-lite": "^0.4.24",

packages/vscode/src/workbench.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import { RawContextKey, IContextKeyService } from "vs/platform/contextkey/common
2929
import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection";
3030
import { URI } from "vs/base/common/uri";
3131

32-
import "vs/loader";
33-
3432
export class Workbench {
3533
private readonly windowId = parseInt(new Date().toISOString().replace(/[-:.TZ]/g, ""), 10);
3634
private _serviceCollection: ServiceCollection | undefined;
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
const path = require("path");
2+
const merge = require("webpack-merge");
3+
4+
const root = path.resolve(__dirname, "../..");
5+
const fills = path.join(root, "packages/ide/src/fill");
6+
const vsFills = path.join(root, "packages/vscode/src/fill");
7+
8+
module.exports = merge(
9+
require(path.join(root, "scripts/webpack.node.config.js"))({
10+
typescriptCompilerOptions: {
11+
target: "es5",
12+
},
13+
}), {
14+
entry: path.join(root, "lib/vscode/src/bootstrap-fork.js"),
15+
mode: "development",
16+
output: {
17+
chunkFilename: "[name].bundle.js",
18+
path: path.resolve(__dirname, "out"),
19+
publicPath: "/",
20+
filename: "bootstrap-fork.js",
21+
libraryTarget: "commonjs",
22+
globalObject: "this",
23+
},
24+
// Due to the dynamic `require.context` we add to `loader.js` Webpack tries
25+
// to include way too much. We can modify what Webpack imports in this case
26+
// (I believe), but for now ignore some things.
27+
module: {
28+
rules: [{
29+
test: /\.(txt|d\.ts|perf\.data\.js|jxs|scpt|exe|sh|less|html|s?css|qwoff|md|svg|png|ttf|woff|eot|woff2)$/,
30+
use: [{
31+
loader: "ignore-loader",
32+
}],
33+
}, {
34+
test: /test|tsconfig/,
35+
use: [{
36+
loader: "ignore-loader",
37+
}],
38+
}, {
39+
test: /(\/vs\/code\/electron-main\/)|(\/test\/)|(OSSREADME\.json$)|(\.(test\.ts|test\.js|d\.ts|qwoff|node|html|txt|exe|wuff|md|sh|scpt|less)$)/,
40+
use: [{
41+
loader: "ignore-loader",
42+
}],
43+
}],
44+
noParse: /\/test\/|\.test\.jsx?|\.test\.tsx?|tsconfig.+\.json$/,
45+
},
46+
resolve: {
47+
alias: {
48+
"gc-signals": path.join(fills, "empty.ts"),
49+
"node-pty": path.resolve(fills, "empty.ts"),
50+
"windows-mutex": path.resolve(fills, "empty.ts"),
51+
"windows-process-tree": path.resolve(fills, "empty.ts"),
52+
53+
"electron": path.join(vsFills, "stdioElectron.ts"),
54+
"native-keymap": path.join(vsFills, "native-keymap.ts"),
55+
"native-watchdog": path.join(vsFills, "native-watchdog.ts"),
56+
"vs/base/common/amd": path.resolve(vsFills, "amd.ts"),
57+
"vs/base/node/paths": path.resolve(vsFills, "paths.ts"),
58+
"vs/platform/node/package": path.resolve(vsFills, "package.ts"),
59+
"vs/platform/node/product": path.resolve(vsFills, "product.ts"),
60+
"vs": path.resolve(root, "lib/vscode/src/vs"),
61+
},
62+
},
63+
resolveLoader: {
64+
alias: {
65+
"vs/css": path.resolve(vsFills, "css.js"),
66+
},
67+
},
68+
}
69+
);

packages/vscode/webpack.config.bootstrap.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)