plugins.ts 913 B

123456789101112131415161718192021222324252627282930313233343536
  1. import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
  2. const CompressionWebpackPlugin = require('compression-webpack-plugin');
  3. export function monacoPluginConfig(config: any) {
  4. return config
  5. .plugin('monaco-editor-webpack-plugin')
  6. .use(MonacoWebpackPlugin, [
  7. {
  8. languages: ['yaml'],
  9. customLanguages: [
  10. {
  11. label: 'yaml',
  12. entry: 'monaco-yaml',
  13. worker: {
  14. id: 'monaco-yaml/yamlWorker',
  15. entry: 'monaco-yaml/yaml.worker.js'
  16. }
  17. }
  18. ]
  19. }
  20. ]);
  21. }
  22. export function compressionPluginConfig(config: any) {
  23. return config
  24. .plugin('compression-webpack-plugin')
  25. .use(CompressionWebpackPlugin, [
  26. {
  27. filename: '[path][base].gz',
  28. algorithm: 'gzip',
  29. test: /\.(js|css|html|svg)$/,
  30. threshold: 10240,
  31. minRatio: 0.8
  32. }
  33. ]);
  34. }