webpack.config.js 1.4 KB

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