webpack.config.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  2. const path = require('path');
  3. module.exports = {
  4. entry: './raw.js',
  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: [MiniCssExtractPlugin.loader, 'css-loader']
  19. },
  20. {
  21. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  22. use: 'url-loader'
  23. },
  24. /* Use null-loader to drop resources that are not used in the CSS */
  25. {
  26. test: /\.(jpg|png|gif)$/,
  27. use: 'null-loader'
  28. },
  29. {
  30. test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
  31. use: 'null-loader'
  32. },
  33. {
  34. test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
  35. use: 'null-loader'
  36. },
  37. {
  38. test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  39. use: 'null-loader'
  40. },
  41. {
  42. test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
  43. use: 'null-loader'
  44. }
  45. ]
  46. }
  47. };