Skip to content

Commit

Permalink
update optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Nov 28, 2024
1 parent 9b51a86 commit 748d864
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"path-browserify": "^1.0.1",
"prettier": "^3.3.3",
"process": "^0.11.10",
"terser-webpack-plugin": "^5.3.10",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.92.1",
Expand Down
13 changes: 11 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@

const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require("terser-webpack-plugin");

//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/

/** @type WebpackConfig */
const webExtensionConfig = {
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
mode: 'production', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
target: 'webworker', // extensions run in a webworker context
entry: './src/extension.ts', // source of the web extension main file
output: {
Expand Down Expand Up @@ -70,7 +75,11 @@ const webExtensionConfig = {

/** @type WebpackConfig */
const nodeExtensionConfig = {
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
mode: 'production', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/

entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
Expand Down

0 comments on commit 748d864

Please sign in to comment.