Merge pull request #1963 from github/koesie10/webpack-production-build
Use Webpack in production mode for releases
This commit is contained in:
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
2
extensions/ql-vscode/gulpfile.ts/dev.ts
Normal file
2
extensions/ql-vscode/gulpfile.ts/dev.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Default to development build; use flag --release to indicate release build.
|
||||
export const isDevBuild = !process.argv.includes("--release");
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user