Skip to content

Commit d5fc287

Browse files
committed
config: wp
1 parent e18c7e8 commit d5fc287

File tree

4 files changed

+42
-34
lines changed

4 files changed

+42
-34
lines changed

.vscodeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
.vscode
44
**/*.map
55
demo
6+
eslint.config.mjs
67
jsconfig.json
78
lab
89
media/res
910
media/vscodeignore
11+
node_modules
1012
src
1113
tasks.js
1214
vsc-extension-quickstart.md

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1616
- New icon and logo<br>
1717
<img src='https://github.com/lanly-dev/VSCode-Spectrogram/blob/main/media/vscodeignore/spec.png?raw=true' width='50' title='spec'/>
1818
<img src='https://github.com/lanly-dev/VSCode-Spectrogram/blob/main/media/spec.png?raw=true' width='55' title='spec3.0'/>
19+
- webpack 5.97.1 compiled with 1 warning in 3211 ms
20+
- 28 files, 355.96 KB, 1.96.0
1921

2022
### Notes
2123
- Clicking treeview item sometimes triggers playing the song, but due to the [autoplay policy](https://developer.chrome.com/blog/autoplay), most of the time you have to click the play button inside the webview

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
"name": "spectrogram",
33
"displayName": "Spectrogram",
44
"description": "Real-time spectrogram",
5-
"version": "2.0.0",
5+
"version": "3.0.0",
66
"publisher": "lanly-dev",
77
"engines": {
8-
"vscode": "^1.71.0"
8+
"vscode": "^1.96.0"
99
},
1010
"categories": [
1111
"Other"
1212
],
1313
"keywords": [
14-
"Audio",
14+
"audio",
1515
"spectrogram",
1616
"mp3",
17-
"flac"
17+
"flac",
18+
"wav"
1819
],
1920
"icon": "media/spec.png",
2021
"galleryBanner": {
@@ -111,10 +112,10 @@
111112
}
112113
},
113114
"scripts": {
114-
"vscode:prepublish": "npm run package",
115+
"vscode:prepublish": "npm run task-clean-output && npm run package",
115116
"vsce-package": "vsce package",
116117
"package": "webpack --mode production --devtool hidden-source-map",
117-
"wp": "webpack",
118+
"wp": "webpack --mode development",
118119
"wp-watch": "webpack --watch",
119120
"task-clean-output": "node tasks.js clean",
120121
"lint": "eslint .",

webpack.config.js

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,37 @@ const TerserPlugin = require('terser-webpack-plugin')
44

55
const path = require('path')
66
const CODICON_PATH = '@vscode/codicons/dist/'
7-
const isProduction = process.env.NODE_ENV === 'production'
87

9-
module.exports = {
10-
target: 'node',
11-
mode: 'none',
12-
devtool: 'inline-cheap-source-map',
13-
entry: './src/extension.js',
14-
output: {
15-
filename: 'extension.js',
16-
libraryTarget: 'commonjs2', // important
17-
path: path.resolve(__dirname, 'dist')
18-
},
19-
externals: {
20-
vscode: 'commonjs vscode'
21-
},
22-
plugins: [
23-
new CopyWebpackPlugin({
24-
patterns: [
25-
{ from: require.resolve(`${CODICON_PATH}/codicon.css`) },
26-
{ from: require.resolve(`${CODICON_PATH}/codicon.ttf`) },
27-
{ from: 'src/controller.js' },
28-
{ from: 'src/index.pug' },
29-
{ from: 'src/style.css' }
30-
]
31-
})
32-
],
33-
optimization: {
34-
minimize: isProduction,
35-
minimizer: isProduction ? [new TerserPlugin({ extractComments: false }), new CssMinimizerPlugin()] : []
8+
module.exports = (env, argv) => {
9+
const { devtool, mode} = argv
10+
console.log('🥼🥼', 'MODE -->', mode, '🥼🥼')
11+
return {
12+
target: 'node',
13+
mode,
14+
devtool,
15+
entry: './src/extension.js',
16+
output: {
17+
filename: 'extension.js',
18+
libraryTarget: 'commonjs2', // important
19+
path: path.resolve(__dirname, 'dist')
20+
},
21+
externals: {
22+
vscode: 'commonjs vscode'
23+
},
24+
plugins: [
25+
new CopyWebpackPlugin({
26+
patterns: [
27+
{ from: require.resolve(`${CODICON_PATH}/codicon.css`) },
28+
{ from: require.resolve(`${CODICON_PATH}/codicon.ttf`) },
29+
{ from: 'src/controller.js' },
30+
{ from: 'src/index.pug' },
31+
{ from: 'src/style.css' }
32+
]
33+
})
34+
],
35+
optimization: {
36+
minimize: mode === 'production',
37+
minimizer: mode === 'production' ? [new TerserPlugin({ extractComments: false }), new CssMinimizerPlugin()] : []
38+
}
3639
}
3740
}

0 commit comments

Comments
 (0)