webpack.config.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. const path = require('path');
  6. const WarningsToErrorsPlugin = require('warnings-to-errors-webpack-plugin');
  7. module.exports = {
  8. mode: 'production',
  9. entry: {
  10. 'core': './core.js',
  11. 'editor.worker': '../../out-monaco-editor-core/esm/vs/editor/editor.worker.js',
  12. },
  13. output: {
  14. globalObject: 'self',
  15. filename: '[name].bundle.js',
  16. path: path.resolve(__dirname, './dist')
  17. },
  18. module: {
  19. rules: [
  20. {
  21. test: /\.css$/,
  22. use: ['style-loader', 'css-loader'],
  23. },
  24. {
  25. test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
  26. use: [
  27. {
  28. loader: 'file-loader',
  29. options: {
  30. name: '[name].[ext]',
  31. outputPath: 'fonts/'
  32. }
  33. }
  34. ]
  35. }
  36. ]
  37. },
  38. resolve: {
  39. alias: {
  40. 'monaco-editor-core/esm/vs/editor/editor.worker': path.resolve(__dirname, '../../out-monaco-editor-core/esm/vs/editor/editor.worker.js'),
  41. 'monaco-editor-core': path.resolve(__dirname, '../../out-monaco-editor-core/esm/vs/editor/editor.main.js'),
  42. }
  43. },
  44. stats: {
  45. all: false,
  46. modules: true,
  47. errors: true,
  48. warnings: true,
  49. // our additional options
  50. moduleTrace: true,
  51. errorDetails: true,
  52. chunks: true
  53. },
  54. plugins: [
  55. new WarningsToErrorsPlugin()
  56. ],
  57. optimization: {
  58. // Without it, CI fails, which indicates a webpack minification bug.
  59. minimize: false,
  60. },
  61. };