webpack.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const path = require("path")
  2. const MiniCssExtractPlugin = require("mini-css-extract-plugin")
  3. const RemoveEmptyScriptsPlugin = require("webpack-remove-empty-scripts")
  4. const CopyPlugin = require("copy-webpack-plugin")
  5. module.exports = {
  6. mode: process.env.NODE_ENV,
  7. entry: {
  8. tubo: path.resolve(__dirname, "resources/src/css/tubo.scss")
  9. },
  10. output: {
  11. path: path.resolve(__dirname, "resources/public")
  12. },
  13. plugins: [
  14. new RemoveEmptyScriptsPlugin(),
  15. new MiniCssExtractPlugin({
  16. filename: "css/[name].css",
  17. }),
  18. new CopyPlugin({
  19. patterns: [
  20. {
  21. from: path.resolve(__dirname, "resources/src/images"),
  22. to: "images"
  23. }
  24. ]
  25. })
  26. ],
  27. module: {
  28. rules: [
  29. {
  30. test: /\.scss$/i,
  31. exclude: /node_modules/,
  32. use: [
  33. MiniCssExtractPlugin.loader,
  34. {
  35. loader: 'css-loader',
  36. options: {
  37. importLoaders: 1
  38. }
  39. },
  40. "postcss-loader",
  41. "sass-loader"
  42. ]
  43. },
  44. {
  45. test: /\.(woff|woff2|eot|ttf|otf)$/i,
  46. type: 'asset/resource',
  47. generator: {
  48. filename: 'fonts/[hash][ext][query]'
  49. }
  50. }
  51. ]
  52. }
  53. }