您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

59 行
1.5 KiB

  1. 'use strict';
  2. const webpack = require('webpack');
  3. const path = require('path');
  4. const nodeExternals = require('webpack-node-externals');
  5. const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
  6. module.exports = function(env, argv) {
  7. if (env === undefined) {
  8. env = {};
  9. }
  10. const minify = !!env.production;
  11. const sourceMaps = !env.production;
  12. const plugins = [
  13. new UglifyJsPlugin({
  14. parallel: true,
  15. sourceMap: sourceMaps,
  16. uglifyOptions: {
  17. ecma: 7,
  18. compress: minify,
  19. mangle: minify,
  20. output: {
  21. beautify: !minify,
  22. comments: false,
  23. ecma: 7
  24. },
  25. sourceMap: sourceMaps,
  26. }
  27. })
  28. ];
  29. return {
  30. entry: './src/extension.ts',
  31. target: 'node',
  32. output: {
  33. libraryTarget: 'commonjs2',
  34. filename: 'extension.js',
  35. path: path.resolve(__dirname, 'out')
  36. },
  37. resolve: {
  38. extensions: ['.ts']
  39. },
  40. externals: [
  41. nodeExternals()
  42. ],
  43. devtool: sourceMaps ? 'inline-source-map' : false,
  44. module: {
  45. rules: [
  46. {
  47. test: /\.ts$/,
  48. use: 'ts-loader',
  49. exclude: /node_modules/
  50. }
  51. ]
  52. },
  53. plugins: plugins
  54. };
  55. };