Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. const path = require('path');
  2. const HtmlWebpackPlugin = require('html-webpack-plugin');
  3. const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  4.  
  5. const isProduction = process.env.NODE_ENV === 'production';
  6.  
  7. module.exports = {
  8. target: 'web',
  9.  
  10. entry: {
  11. // vendor: [
  12. // ],
  13. main: path.resolve(__dirname, 'src', 'index.jsx'),
  14. },
  15.  
  16. output: {
  17. path: path.resolve(__dirname, 'dist'),
  18. filename: '[name].[chunkhash].js',
  19. publicPath: '/',
  20. },
  21.  
  22. module: {
  23. rules: [
  24. {
  25. test: /\.jsx?$/,
  26. exclude: /node_modules/,
  27. use: ['babel-loader'],
  28. },
  29. {
  30. test: /\.s?[ac]ss$/,
  31. use: [
  32. isProduction ? MiniCssExtractPlugin.loader : 'style-loader',
  33. 'css-loader',
  34. 'postcss-loader',
  35. 'sass-loader',
  36. ],
  37. },
  38. {
  39. test: /\.(png|svg|jpg|gif)$/,
  40. use: ['file-loader'],
  41. },
  42. {
  43. test: /\.(woff|woff2|eot|ttf|otf)$/,
  44. use: ['file-loader'],
  45. },
  46. ],
  47. },
  48.  
  49. plugins: [
  50. new HtmlWebpackPlugin({
  51. inject: false,
  52. template: path.join('src', 'index.html'),
  53. title: 'title',
  54. }),
  55. new MiniCssExtractPlugin({}),
  56. ],
  57.  
  58. resolve: {
  59. extensions: ['.js', '.jsx', '.css', '.scss'],
  60. },
  61. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement