webpack.config.ts 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as path from 'path';
  2. import * as webpack from 'webpack';
  3. import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
  4. const config: webpack.Configuration = {
  5. // VSCode extensions run in webworker context for VS Code web
  6. target: 'webworker',
  7. entry: './src/extension.ts',
  8. output: {
  9. path: path.resolve(__dirname, 'dist'),
  10. filename: 'extension.js',
  11. libraryTarget: 'commonjs2',
  12. devtoolModuleFilenameTemplate: '../[resource-path]'
  13. },
  14. devtool: 'source-map',
  15. externals: {
  16. // The vscode-module is created on-the-fly and must be excluded.
  17. vscode: 'commonjs vscode'
  18. },
  19. resolve: {
  20. mainFields: ['main'],
  21. extensions: ['.ts'],
  22. plugins: [
  23. // Plugin for using aliases from tsconfig paths
  24. new TsconfigPathsPlugin()
  25. ]
  26. },
  27. module: {
  28. rules: [
  29. {
  30. test: /\.ts$/,
  31. exclude: /node_modules/,
  32. use: [
  33. {
  34. loader: 'ts-loader'
  35. }
  36. ]
  37. }
  38. ]
  39. }
  40. };
  41. export default config;