webpack.config.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  2. const path = require('path');
  3. module.exports = {
  4. mode: 'production',
  5. entry: {
  6. index: './style/index.css',
  7. embed: './style/embed.css'
  8. },
  9. output: {
  10. path: path.resolve(__dirname, 'static'),
  11. // we won't use these JS files, only the extracted CSS
  12. filename: '[name].js'
  13. },
  14. module: {
  15. rules: [
  16. { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
  17. {
  18. test: /\.svg/,
  19. use: [
  20. { loader: 'svg-url-loader', options: {} },
  21. { loader: 'svgo-loader', options: { plugins: [] } }
  22. ]
  23. },
  24. {
  25. test: /\.(png|jpg|gif|ttf|woff|woff2|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  26. use: [{ loader: 'url-loader', options: { limit: 10000 } }]
  27. }
  28. ]
  29. },
  30. plugins: [
  31. new MiniCssExtractPlugin({
  32. // Options similar to the same options in webpackOptions.output
  33. // both options are optional
  34. filename: '[name].css',
  35. chunkFilename: '[id].css'
  36. })
  37. ]
  38. };