webpack.config.js 1000 B

1234567891011121314151617181920212223242526272829303132333435
  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. { test: /\.svg/, use: [
  18. { loader: 'svg-url-loader', options: {} },
  19. { loader: 'svgo-loader', options: {plugins: []} }
  20. ]},
  21. { test: /\.(png|jpg|gif|ttf|woff|woff2|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  22. use: [{ loader: 'url-loader', options: {limit: 10000} }]
  23. }
  24. ]
  25. },
  26. plugins: [
  27. new MiniCssExtractPlugin({
  28. // Options similar to the same options in webpackOptions.output
  29. // both options are optional
  30. filename: '[name].css',
  31. chunkFilename: '[id].css'
  32. })
  33. ]
  34. };