webpack.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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: ['@svgr/webpack']
  27. },
  28. {
  29. test: /\.ttf$/,
  30. use: ['file-loader']
  31. }
  32. ],
  33. plugins: [
  34. new MiniCssExtractPlugin({
  35. // Options similar to the same options in webpackOptions.output
  36. // both options are optional
  37. filename: "[name].css",
  38. chunkFilename: "[id].css"
  39. }),
  40. new MonacoWebpackPlugin({
  41. languages: ["typescript", "javascript"],
  42. publicPath: "/dist/preview release/Playground"
  43. })
  44. ]
  45. });
  46. module.exports = config;