webpack.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  2. const path = require('path');
  3. module.exports = {
  4. entry: './raw.css',
  5. output: {
  6. filename: 'index.js',
  7. path: path.resolve(__dirname, 'style')
  8. },
  9. plugins: [
  10. new MiniCssExtractPlugin({
  11. filename: 'index.css'
  12. })
  13. ],
  14. module: {
  15. rules: [
  16. {
  17. test: /\.css$/,
  18. use: [
  19. {
  20. loader: MiniCssExtractPlugin.loader,
  21. options: {
  22. hmr: process.env.NODE_ENV === 'development'
  23. }
  24. },
  25. 'css-loader'
  26. ]
  27. },
  28. {
  29. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  30. use: 'url-loader'
  31. },
  32. /* Use null-loader to drop resources that are not used in the CSS */
  33. {
  34. test: /\.(jpg|png|gif)$/,
  35. use: 'null-loader'
  36. },
  37. {
  38. test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
  39. use: 'null-loader'
  40. },
  41. {
  42. test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
  43. use: 'null-loader'
  44. },
  45. {
  46. test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  47. use: 'null-loader'
  48. },
  49. {
  50. test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
  51. use: 'null-loader'
  52. }
  53. ]
  54. }
  55. };