webpack.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const ExtractTextPlugin = require('extract-text-webpack-plugin');
  2. const path = require('path');
  3. module.exports = {
  4. entry: './style/index.css',
  5. output: {
  6. path: path.resolve(__dirname, 'static'),
  7. // we won't use this JS file, only the extracted CSS
  8. filename: 'ignore.js'
  9. },
  10. module: {
  11. rules: [
  12. {
  13. test: /\.css$/,
  14. use: ExtractTextPlugin.extract({
  15. fallback: 'style-loader',
  16. use: 'css-loader'
  17. })
  18. },
  19. {
  20. test: /\.svg/,
  21. use: [
  22. {
  23. loader: 'svg-url-loader',
  24. options: {
  25. }
  26. },
  27. {
  28. loader: 'svgo-loader',
  29. options: {
  30. plugins: [
  31. ]
  32. }
  33. }
  34. ]
  35. },
  36. {
  37. test: /\.(png|jpg|gif|ttf)$/,
  38. use: [
  39. {
  40. loader: 'url-loader',
  41. options: {
  42. limit: 10000
  43. }
  44. }
  45. ]
  46. }
  47. ]
  48. },
  49. plugins: [
  50. new ExtractTextPlugin('index.css'),
  51. ]
  52. };