|  | 
|  | 1 | +/*--------------------------------------------------------------------------------------------- | 
|  | 2 | + *  Copyright (c) Microsoft Corporation. All rights reserved. | 
|  | 3 | + *  Licensed under the MIT License. See License.txt in the project root for license information. | 
|  | 4 | + *--------------------------------------------------------------------------------------------*/ | 
|  | 5 | + | 
|  | 6 | +//@ts-check | 
|  | 7 | + | 
|  | 8 | +'use strict'; | 
|  | 9 | + | 
|  | 10 | +const path = require('path'); | 
|  | 11 | + | 
|  | 12 | +/**@type {import('webpack').Configuration}*/ | 
|  | 13 | +const config = { | 
|  | 14 | +  target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ | 
|  | 15 | + | 
|  | 16 | +  entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ | 
|  | 17 | +  output: { | 
|  | 18 | +    // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ | 
|  | 19 | +    path: path.resolve(__dirname, 'out'), | 
|  | 20 | +    filename: 'extension.js', | 
|  | 21 | +    libraryTarget: 'commonjs2', | 
|  | 22 | +    devtoolModuleFilenameTemplate: '../[resource-path]', | 
|  | 23 | +  }, | 
|  | 24 | +  devtool: 'source-map', | 
|  | 25 | +  externals: { | 
|  | 26 | +    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/ | 
|  | 27 | +    got: 'got', | 
|  | 28 | +    keytar: 'keytar', | 
|  | 29 | +  }, | 
|  | 30 | +  resolve: { | 
|  | 31 | +    // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader | 
|  | 32 | +    extensions: ['.ts', '.js'], | 
|  | 33 | +    alias: { | 
|  | 34 | +      src: path.resolve(__dirname, 'src'), | 
|  | 35 | +    }, | 
|  | 36 | +  }, | 
|  | 37 | +  module: { | 
|  | 38 | +    rules: [ | 
|  | 39 | +      { | 
|  | 40 | +        test: /\.ts$/, | 
|  | 41 | +        exclude: /node_modules/, | 
|  | 42 | +        use: [ | 
|  | 43 | +          { | 
|  | 44 | +            loader: 'ts-loader', | 
|  | 45 | +            options: { | 
|  | 46 | +              compilerOptions: { | 
|  | 47 | +                module: 'es6', // override `tsconfig.json` so that TypeScript emits native JavaScript modules. | 
|  | 48 | +              }, | 
|  | 49 | +            }, | 
|  | 50 | +          }, | 
|  | 51 | +        ], | 
|  | 52 | +      }, | 
|  | 53 | +    ], | 
|  | 54 | +  }, | 
|  | 55 | +}; | 
|  | 56 | + | 
|  | 57 | +module.exports = config; | 
0 commit comments