webpack.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const Path = require('path')
  2. const HtmlWebpackPlugin = require('html-webpack-plugin')
  3. const LiveReloadPlugin = require('webpack-livereload-plugin')
  4. const WebpackPwaManifest = require('webpack-pwa-manifest')
  5. module.exports = {
  6. entry: './src/index.js',
  7. mode: process.env.NODE_ENV || 'development',
  8. devServer: {
  9. contentBase: Path.join(__dirname, 'dist')
  10. },
  11. module: {
  12. rules: [
  13. {
  14. test: /\.m?js$/,
  15. exclude: /node_modules/,
  16. use: {
  17. loader: 'babel-loader',
  18. options: {
  19. presets: ['@babel/preset-env', '@babel/preset-react']
  20. }
  21. }
  22. }
  23. ]
  24. },
  25. plugins: [
  26. new HtmlWebpackPlugin({
  27. meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no'}
  28. }),
  29. new WebpackPwaManifest({
  30. name: 'CHANGEME',
  31. short_name: 'changeme',
  32. description: 'This is an installable app.',
  33. background_color: '#ffffff',
  34. icons: [
  35. {
  36. src: Path.resolve('src/assets/placeholder_icon.png'),
  37. sizes: [96, 128, 192, 256, 384, 512]
  38. }
  39. ],
  40. inject: true,
  41. orientation: 'omit'
  42. }),
  43. new LiveReloadPlugin({
  44. appendScriptTag: true
  45. })
  46. ]
  47. }