webpack.config.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const path = require('path');
  2. const merge = require('deepmerge');
  3. const baseConfig = require('../base-webpack.config');
  4. const babelOptions = {
  5. presets: ['react', 'es2015'],
  6. plugins: ['transform-object-rest-spread']
  7. };
  8. const config = merge(baseConfig, {
  9. context: __dirname,
  10. entry: './main.jsx',
  11. output: {
  12. path: path.resolve(__dirname, 'build')
  13. },
  14. module: {
  15. rules: [
  16. {
  17. test: /\.jsx$/,
  18. loader: 'babel-loader',
  19. options: babelOptions
  20. },
  21. {
  22. test: /\.svg$/,
  23. use: [
  24. {
  25. loader: 'babel-loader',
  26. options: babelOptions
  27. },
  28. {
  29. loader: 'svg-sprite-loader',
  30. options: {
  31. runtimeGenerator: require.resolve('./svg-to-icon-component-runtime-generator'),
  32. runtimeOptions: {
  33. iconModule: './icon.jsx' // Relative to current build context folder
  34. }
  35. }
  36. }
  37. ],
  38. }
  39. ]
  40. }
  41. });
  42. module.exports = config;