text: const path = require('path')
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const WebpackPwaManifestPlugin = require('webpack-pwa-manifest')
  const WorkboxWebpackPlugin = require('workbox-webpack-plugin')
  
  module.exports = {
    output: {
      filename: 'app.bundle.js',
      publicPath: '/'
    },
    plugins: [
      new HtmlWebpackPlugin({
        template: 'src/public/index.html'
      }),
      new WebpackPwaManifestPlugin({
        name: 'Petgram - Tu app de fotos de macotas',
        short_name: 'Petgram 🐶',
        description: 'Con petgram puedes encontrar fotos de animales domésticos muy facilmente',
        background_color: '#fff',
        theme_color: '#e252d4',
        icons: [
          {
            src: path.resolve('src/assets/icon.png'),
            sizes: [96, 128, 192, 256, 384, 512]
          }
        ]
      }),
      new WorkboxWebpackPlugin.GenerateSW({
        runtimeCaching: [
          {
            urlPattern: new RegExp('https://(res.cloudinary.com|images.unsplash.com)'),
            handler: 'CacheFirst',
            options: {
              cacheName: 'images'
            }
          },
          {
            urlPattern: new RegExp('http://petgramserver-gp0xvypt8.now.sh'),
            handler: 'NetworkFirst',
            options: {
              cacheName: 'api'
            }
          }
        ]
      })
    ],
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader',
            options: {
              plugins: ['@babel/plugin-syntax-dynamic-import'],
              presets: ['@babel/preset-env', '@babel/preset-react']
            }
          }
        },
        {
          test: /\.(jpg|png|gif|woff|eot|ttf|svg|mp4|webm)$/,
          use: {
            loader: "url-loader",
            options: {
              limit: 1000,
              name: "[hash].[ext]",
              outputPath: "assets"
            }
          }
        }
      ]
    },
    devServer: {
      port: 9000,
      historyApiFallback: true
    }
  }
  