Guest User

Untitled

a guest
Feb 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. const path = require('path')
  2. const mode = process.env.NODE_ENV
  3. const MiniCSSExtractPlugin = require('mini-css-extract-plugin')
  4.  
  5. module.exports = {
  6. mode,
  7. entry: ['./resources/scripts/main.js', './resources/sass/main.sass'],
  8. output: {
  9. path: path.join(__dirname, 'public'),
  10. filename: '[name].bundle.js',
  11. publicPath: '/public'
  12. },
  13. plugins: [
  14. new MiniCSSExtractPlugin({
  15. filename: mode == 'production' ? '[name].[hash].css' : '[name].css',
  16. chunkFilename: mode == 'production' ? '[id].[hash].css' : '[id].css'
  17. })
  18. ],
  19. module: {
  20. rules: [
  21. {
  22. test: /.js$/,
  23. exclude: /(node_modules|bower_components)/,
  24. use: {
  25. loader: 'babel-loader?cacheDirectory=true',
  26. options: {
  27. presets: ['@babel/preset-env']
  28. }
  29. }
  30. },
  31. {
  32. test: /.(sa|c|sc)ss$/,
  33. exclude: /(node_modules|bower_components)/,
  34. use: [
  35. mode == 'production' ? MiniCSSExtractPlugin.loader : 'style-loader',
  36. 'css-loader',
  37. 'sass-loader'
  38. ]
  39. }
  40. ]
  41. }
  42. }
Add Comment
Please, Sign In to add comment