webpack.config.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const path = require("path");
  2. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  3. const babylonWebpackConfig = require('../Tools/WebpackPlugins/babylonWebpackConfig');
  4. const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
  5. var config = babylonWebpackConfig({
  6. module: "playground",
  7. resolve: {
  8. extensions: [".js", '.ts', ".tsx"],
  9. },
  10. moduleRules: [
  11. {
  12. test: /\.scss$/,
  13. use: [
  14. // fallback to style-loader in development
  15. process.env.NODE_ENV !== 'production' ? 'style-loader' : MiniCssExtractPlugin.loader,
  16. "css-loader",
  17. "sass-loader"
  18. ]
  19. },
  20. {
  21. test: /\.css$/,
  22. use: ['style-loader', 'css-loader']
  23. },
  24. {
  25. test: /\.svg$/,
  26. use: [
  27. {
  28. loader: 'svg-url-loader',
  29. options: {
  30. limit: 10000,
  31. },
  32. },
  33. ],
  34. }, {
  35. test: /\.ttf$/,
  36. use: ['file-loader']
  37. }
  38. ],
  39. plugins: [
  40. new MiniCssExtractPlugin({
  41. // Options similar to the same options in webpackOptions.output
  42. // both options are optional
  43. filename: "[name].css",
  44. chunkFilename: "[id].css"
  45. }),
  46. new MonacoWebpackPlugin({
  47. languages: ["typescript", "javascript"],
  48. })
  49. ]
  50. });
  51. module.exports = config;