Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
  4. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  5. const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
  6. const CleanWebpackPlugin = require('clean-webpack-plugin');
  7.  
  8. module.exports = {
  9. entry: {
  10. main: './src/features/main/index.js',
  11. admin: './src/features/admin/index.js'
  12. },
  13. output: {
  14. filename: '[name].entry.js',
  15. path: path.resolve(__dirname, 'public/dist')
  16. },
  17. module: {
  18. rules: [
  19. {
  20. test: /\.js$/,
  21. exclude: /node_modules/,
  22. loader: "eslint-loader"
  23. },
  24. {
  25. test: /\.css$/,
  26. exclude: /node_modules/,
  27. use: [
  28. {
  29. loader: MiniCssExtractPlugin.loader
  30. },
  31. 'css-loader',
  32. 'postcss-loader'
  33. ]
  34. }
  35. ]
  36. },
  37. plugins: [
  38. new MiniCssExtractPlugin({
  39. filename: "[name].css"
  40. }),
  41. new CleanWebpackPlugin(),
  42. new OptimizeCssAssetsPlugin({
  43. assetNameRegExp: /\.css$/g,
  44. cssProcessor: require('cssnano'),
  45. cssProcessorPluginOptions: {
  46. preset: ['default', { discardComments: { removeAll: true } }]
  47. },
  48. canPrint: true
  49. }),
  50. new webpack.ProvidePlugin({
  51. $: 'jquery',
  52. jQuery: 'jquery',
  53. 'window.jQuery': 'jquery'
  54. }),
  55. new BrowserSyncPlugin({
  56. proxy: 'localhost:8000',
  57. host: 'localhost',
  58. port: 3000,
  59. files: ['./src/*'],
  60. injectChanges: true
  61. })
  62. ]
  63. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement