You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stylesheets.babel.js 1.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**
  2. * @prettier
  3. */
  4. // NOTE: this config *does not* inherit from `_config-builder`.
  5. // It is also used in the dev config.
  6. import path from "path"
  7. import MiniCssExtractPlugin from "mini-css-extract-plugin"
  8. import IgnoreAssetsPlugin from "ignore-assets-webpack-plugin"
  9. import OptimizeCSSAssetsPlugin from "optimize-css-assets-webpack-plugin"
  10. export default {
  11. mode: "production",
  12. entry: {
  13. "swagger-ui": "./src/style/main.scss",
  14. },
  15. module: {
  16. rules: [
  17. {
  18. test: [/\.(scss)(\?.*)?$/],
  19. use: [
  20. {
  21. loader: MiniCssExtractPlugin.loader,
  22. },
  23. {
  24. loader: "css-loader",
  25. options: { sourceMap: true },
  26. },
  27. {
  28. loader: "postcss-loader",
  29. options: {
  30. sourceMap: true,
  31. plugins: loader => [
  32. require("cssnano")(),
  33. require("autoprefixer")(),
  34. ],
  35. },
  36. },
  37. {
  38. loader: "sass-loader",
  39. options: {
  40. outputStyle: "expanded",
  41. sourceMap: true,
  42. sourceMapContents: "true",
  43. },
  44. },
  45. ],
  46. },
  47. ],
  48. },
  49. plugins: [
  50. new MiniCssExtractPlugin({
  51. filename: "[name].css",
  52. }),
  53. new IgnoreAssetsPlugin({
  54. // This is a hack to avoid a Webpack/MiniCssExtractPlugin bug, for more
  55. // info see https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151
  56. ignore: ["swagger-ui.js", "swagger-ui.js.map"],
  57. }),
  58. ],
  59. devtool: "source-map",
  60. output: {
  61. path: path.join(__dirname, "../", "dist"),
  62. publicPath: "/dist",
  63. },
  64. optimization: {
  65. splitChunks: {
  66. cacheGroups: {
  67. styles: {
  68. name: "styles",
  69. test: /\.css$/,
  70. chunks: "all",
  71. enforce: true,
  72. },
  73. },
  74. },
  75. },
  76. }