Merge pull request #1963 from github/koesie10/webpack-production-build

Use Webpack in production mode for releases
This commit is contained in:
Koen Vlaswinkel
2023-01-17 09:49:59 +01:00
committed by GitHub
4 changed files with 15 additions and 4 deletions

View File

@@ -59,6 +59,12 @@ jobs:
name: vscode-codeql-extension
path: artifacts
- name: Upload source maps
uses: actions/upload-artifact@v3
with:
name: vscode-codeql-sourcemaps
path: dist/vscode-codeql/out/*.map
# TODO Run tests, or check that a test run on the same branch succeeded.
- name: Create release

View File

@@ -8,6 +8,7 @@ import {
writeFile,
} from "fs-extra";
import { resolve, join } from "path";
import { isDevBuild } from "./dev";
export interface DeployedPackage {
distPath: string;
@@ -53,8 +54,6 @@ export async function deployPackage(
await readFile(packageJsonPath, "utf8"),
);
// Default to development build; use flag --release to indicate release build.
const isDevBuild = !process.argv.includes("--release");
const distDir = join(__dirname, "../../../dist");
await mkdirs(distDir);

View File

@@ -0,0 +1,2 @@
// Default to development build; use flag --release to indicate release build.
export const isDevBuild = !process.argv.includes("--release");

View File

@@ -1,9 +1,10 @@
import { resolve } from "path";
import * as webpack from "webpack";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import { isDevBuild } from "./dev";
export const config: webpack.Configuration = {
mode: "development",
mode: isDevBuild ? "development" : "production",
entry: {
webview: "./src/view/webview.tsx",
},
@@ -11,7 +12,7 @@ export const config: webpack.Configuration = {
path: resolve(__dirname, "..", "out"),
filename: "[name].js",
},
devtool: "inline-source-map",
devtool: isDevBuild ? "inline-source-map" : "source-map",
resolve: {
extensions: [".js", ".ts", ".tsx", ".json"],
fallback: {
@@ -53,6 +54,9 @@ export const config: webpack.Configuration = {
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
sourceMap: true,
},
},
],
},