Skip to content

Commit 7b5e5a6

Browse files
authored
Merge pull request #1963 from github/koesie10/webpack-production-build
Use Webpack in production mode for releases
2 parents 80f588c + b4bb1b6 commit 7b5e5a6

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ jobs:
5959
name: vscode-codeql-extension
6060
path: artifacts
6161

62+
- name: Upload source maps
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: vscode-codeql-sourcemaps
66+
path: dist/vscode-codeql/out/*.map
67+
6268
# TODO Run tests, or check that a test run on the same branch succeeded.
6369

6470
- name: Create release

extensions/ql-vscode/gulpfile.ts/deploy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
writeFile,
99
} from "fs-extra";
1010
import { resolve, join } from "path";
11+
import { isDevBuild } from "./dev";
1112

1213
export interface DeployedPackage {
1314
distPath: string;
@@ -53,8 +54,6 @@ export async function deployPackage(
5354
await readFile(packageJsonPath, "utf8"),
5455
);
5556

56-
// Default to development build; use flag --release to indicate release build.
57-
const isDevBuild = !process.argv.includes("--release");
5857
const distDir = join(__dirname, "../../../dist");
5958
await mkdirs(distDir);
6059

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Default to development build; use flag --release to indicate release build.
2+
export const isDevBuild = !process.argv.includes("--release");

extensions/ql-vscode/gulpfile.ts/webpack.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { resolve } from "path";
22
import * as webpack from "webpack";
33
import MiniCssExtractPlugin from "mini-css-extract-plugin";
4+
import { isDevBuild } from "./dev";
45

56
export const config: webpack.Configuration = {
6-
mode: "development",
7+
mode: isDevBuild ? "development" : "production",
78
entry: {
89
webview: "./src/view/webview.tsx",
910
},
1011
output: {
1112
path: resolve(__dirname, "..", "out"),
1213
filename: "[name].js",
1314
},
14-
devtool: "inline-source-map",
15+
devtool: isDevBuild ? "inline-source-map" : "source-map",
1516
resolve: {
1617
extensions: [".js", ".ts", ".tsx", ".json"],
1718
fallback: {
@@ -53,6 +54,9 @@ export const config: webpack.Configuration = {
5354
MiniCssExtractPlugin.loader,
5455
{
5556
loader: "css-loader",
57+
options: {
58+
sourceMap: true,
59+
},
5660
},
5761
],
5862
},

0 commit comments

Comments
 (0)