webpack.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //@ts-check
  2. 'use strict';
  3. const path = require('path');
  4. //@ts-check
  5. /** @typedef {import('webpack').Configuration} WebpackConfig **/
  6. /** @type WebpackConfig */
  7. const extensionConfig = {
  8. target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
  9. mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
  10. entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
  11. output: {
  12. // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
  13. path: path.resolve(__dirname, 'dist'),
  14. filename: 'extension.js',
  15. libraryTarget: 'commonjs2'
  16. },
  17. externals: {
  18. 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/
  19. // modules added here also need to be added in the .vscodeignore file
  20. },
  21. resolve: {
  22. // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
  23. extensions: ['.ts', '.js']
  24. },
  25. module: {
  26. rules: [
  27. {
  28. test: /\.ts$/,
  29. exclude: /node_modules/,
  30. use: [
  31. {
  32. loader: 'ts-loader'
  33. }
  34. ]
  35. }
  36. ]
  37. },
  38. devtool: 'nosources-source-map',
  39. infrastructureLogging: {
  40. level: "log", // enables logging required for problem matchers
  41. },
  42. };
  43. module.exports = [ extensionConfig ];