Advertisement
Guest User

Untitled

a guest
May 14th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const HtmlWebpackPlugin = require('html-webpack-plugin');
  4.  
  5.  
  6. module.exports = {
  7. entry: {
  8. main: './src/components/index.js'
  9. },
  10.  
  11. output: {
  12. path: path.resolve(__dirname, 'dist'),
  13. filename: 'static/js/[name].[contenthash:8].js'
  14. },
  15.  
  16. module: {
  17. rules: [
  18. {
  19. test: /\.(js|jsx)$/,
  20. loader: 'babel-loader',
  21. options: {
  22. cacheDirectory: true,
  23. cacheCompression: false,
  24. babelrc: true
  25. }
  26. },
  27. { test: /\.json$/, loader: 'json-loader' },
  28. {
  29. test: /\.css$/,
  30. use: [
  31. 'style-loader',
  32. 'css-loader'
  33. ]
  34. },
  35. {
  36. exclude: [/\.(js|jsx)$/, /.html$/, /.css$/, /.json$/],
  37. loader: 'file-loader',
  38. options: {
  39. name: 'static/media/[name].[contenthash:8].[ext]'
  40. }
  41. }
  42. ]
  43. },
  44.  
  45. resolve: {
  46. unsafeCache: true,
  47. extensions: ['.js', '.jsx', '.json', '.css'],
  48. alias: {
  49. actions: path.resolve(__dirname, './src/actions'),
  50. reducers: path.resolve(__dirname, './src/reducers'),
  51. components: path.resolve(__dirname, './src/components'),
  52. lib: path.resolve(__dirname, './src/components/_lib'),
  53. styles: path.resolve(__dirname, './src/styles'),
  54. config: path.resolve(__dirname, './src/config')
  55. }
  56. },
  57.  
  58. plugins: [
  59. new HtmlWebpackPlugin({
  60. template: './src/public/index.html',
  61. favicon: './src/public/favicon.ico'
  62. }),
  63. new webpack.PrefetchPlugin('react'),
  64. new webpack.PrefetchPlugin('react-dom')
  65. ],
  66.  
  67. optimization: {
  68. usedExports: true
  69. }
  70. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement