You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 rivejä
1.0 KiB

6 vuotta sitten
  1. 'use strict';
  2. const path = require('path');
  3. const nodeExternals = require('webpack-node-externals');
  4. const CleanWebpackPlugin = require("clean-webpack-plugin");
  5. module.exports = function(env, argv) {
  6. env = env || {};
  7. const production = !!env.production;
  8. const plugins = [new CleanWebpackPlugin(["out"])];
  9. return {
  10. entry: './src/extension.ts',
  11. mode: production ? 'production' : 'development',
  12. target: 'node',
  13. devtool: !production ? 'eval-source-map' : undefined,
  14. output: {
  15. libraryTarget: 'commonjs2',
  16. filename: 'extension.js',
  17. path: path.resolve(__dirname, 'out')
  18. },
  19. resolve: {
  20. extensions: ['.tsx', '.ts', '.js']
  21. },
  22. externals: [nodeExternals()],
  23. module: {
  24. rules: [
  25. {
  26. test: /\.tsx?$/,
  27. use: 'ts-loader',
  28. exclude: /node_modules/
  29. }
  30. ]
  31. },
  32. plugins: plugins
  33. };
  34. };