webpack.config.js 1.3 KB

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