module.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const ExtractTextPlugin = require("extract-text-webpack-plugin");
  2. module.exports = function(theme) {
  3. return {
  4. rules: [{
  5. test: /\.jsx?$/,
  6. exclude: /node_modules/,
  7. use: {
  8. loader: 'babel-loader',
  9. options: {
  10. "presets": ["es2015", "react"],
  11. "plugins": [
  12. ["antd", {
  13. "style": true
  14. }]
  15. ]
  16. }
  17. }
  18. }, {
  19. test: /\.css$/,
  20. use: ExtractTextPlugin.extract({
  21. fallback: 'style-loader',
  22. use: [{
  23. loader: 'css-loader',
  24. options: {
  25. importLoaders: 1
  26. }
  27. }]
  28. })
  29. }, {
  30. test: /\.less$/,
  31. use: ExtractTextPlugin.extract({
  32. fallback: 'style-loader',
  33. use: [{
  34. loader: 'css-loader',
  35. options: {
  36. importLoaders: 1
  37. }
  38. }, {
  39. loader: 'less-loader',
  40. options: {
  41. modifyVars: theme
  42. }
  43. }]
  44. })
  45. }, {
  46. test: /\.(png|jpg)$/,
  47. use: [{
  48. loader: 'url-loader',
  49. options: {
  50. limit: 10240,
  51. name: '[path][name].[ext]'
  52. }
  53. }]
  54. }, {
  55. test: /\.(woff|svg|eot|ttf)$/,
  56. use: [{
  57. loader: 'url-loader',
  58. options: {
  59. limit: 1,
  60. name: '[path][name].[ext]'
  61. }
  62. }]
  63. }]
  64. };
  65. }