Skip to content

Commit abc692a

Browse files
committed
1 parent 81d617f commit abc692a

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.vscodeignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,13 @@
22
.vscode-test/**
33
**/*.blend*
44
**/test*/
5+
6+
# Source:
7+
# https://code.visualstudio.com/api/working-with-extensions/bundling-extension#publishing
8+
.vscode
9+
node_modules
10+
out/
11+
src/
12+
tsconfig.json
13+
webpack.config.js
14+
esbuild.js

webpack.config.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// This file is mostly (or fully) copied from here:
2+
// https://code.visualstudio.com/api/working-with-extensions/bundling-extension#configure-webpack
3+
4+
//@ts-check
5+
6+
'use strict'
7+
8+
const path = require('path')
9+
const webpack = require('webpack')
10+
11+
/**@type {import('webpack').Configuration}*/
12+
const config = {
13+
target: 'webworker', // vscode extensions run in webworker context for VS Code web 📖 -> https://webpack.js.org/configuration/target/#target
14+
15+
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
16+
output: {
17+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
18+
path: path.resolve(__dirname, 'dist'),
19+
filename: 'extension.js',
20+
libraryTarget: 'commonjs2',
21+
devtoolModuleFilenameTemplate: '../[resource-path]'
22+
},
23+
devtool: 'source-map',
24+
externals: {
25+
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
26+
},
27+
resolve: {
28+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
29+
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
30+
extensions: ['.ts', '.js'], // FIXME: Johan: Remove .js? We aren't doing any JavaScript.
31+
alias: {
32+
// provides alternate implementation for node module and source files
33+
},
34+
fallback: {
35+
// Webpack 5 no longer polyfills Node.js core modules automatically.
36+
// see https://webpack.js.org/configuration/resolve/#resolvefallback
37+
// for the list of Node.js core module polyfills.
38+
}
39+
},
40+
module: {
41+
rules: [
42+
{
43+
test: /\.ts$/,
44+
exclude: /node_modules/,
45+
use: [
46+
{
47+
loader: 'ts-loader'
48+
}
49+
]
50+
}
51+
]
52+
}
53+
}
54+
module.exports = config

0 commit comments

Comments
 (0)