text: //@ts-check
  
  'use strict';
  
  const path = require('path');
  const CopyPlugin = require("copy-webpack-plugin");
  
  /**@type {import('webpack').Configuration}*/
  const commonConfig = {
      target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
      mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
      devtool: 'nosources-source-map',
      externals: {
          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/
          // modules added here also need to be added in the .vsceignore file
      },
      resolve: {
          // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
          extensions: ['.ts', '.js']
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  enforce: 'pre',
                  loader: 'source-map-loader',
                  exclude: /vscode/
              },
              {
                  test: /\.ts$/,
                  exclude: /node_modules/,
                  loader: 'ts-loader'
              }
          ]
      }
  }
  
  /**@type {import('webpack').Configuration}*/
  const lspConfig = {
      ...commonConfig,
      entry: './src/language-server/main.ts', // the entry point of the language server, 📖 -> https://webpack.js.org/configuration/entry-context/
      output: {
          path: path.resolve(__dirname, 'out', 'language-server'),
          filename: 'main.js',
          libraryTarget: 'commonjs2',
          devtoolModuleFilenameTemplate: '../../[resource-path]',
          clean: true
      },
      plugins: [
          new CopyPlugin({ // This copy plugin call is required to put the generated grammar file in the right directory
              patterns: [
                  {
                      from: path.resolve(__dirname, 'src/language-server/generated/grammar.json'),
                      to: path.resolve(__dirname, 'out/language-server')
                  }
              ]
          })
      ]
  };
  
  /**@type {import('webpack').Configuration}*/
  const vscodeConfig = {
      ...commonConfig,
      entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
      output: {
          path: path.resolve(__dirname, 'out'),
          filename: 'extension.js',
          libraryTarget: 'commonjs2',
          devtoolModuleFilenameTemplate: '../[resource-path]'
      }
  };
  module.exports = [lspConfig, vscodeConfig];