Advertisement
Guest User

Untitled

a guest
May 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. const mix = require('laravel-mix');
  2. const DashboardPlugin = require('webpack-dashboard/plugin');
  3. const webpack = require('webpack');
  4. const path = require('path');
  5.  
  6. /*
  7. |--------------------------------------------------------------------------
  8. | Mix Asset Management
  9. |--------------------------------------------------------------------------
  10. |
  11. | Mix provides a clean, fluent API for defining some Webpack build steps
  12. | for your Laravel application. By default, we are compiling the Sass
  13. | file for your application, as well as bundling up your JS files.
  14. |
  15. */
  16.  
  17. const assetsDir = './resources/assets/';
  18.  
  19. mix
  20. .setPublicPath('public')
  21. .js(`${assetsDir}js/app.js`, 'public/js')
  22. .sass(`${assetsDir}scss/app.scss`, 'public/css')
  23. .extract([
  24. 'vue',
  25. 'vuex',
  26. 'vue-touch',
  27. 'moment',
  28. 'axios',
  29. 'velocity-animate'
  30. ])
  31. .version()
  32. .options({
  33. // @TODO Currently removes too much probably because of incorrect file scans.
  34. // purifyCss: true,
  35. // extractVueStyles: 'public/css/vue-css.css',
  36. processCssUrls: false
  37. });
  38.  
  39. // Version our images?
  40. mix.version(['public/images/svg'])
  41.  
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Vendor SCSS file
  45. |--------------------------------------------------------------------------
  46. |
  47. | The vendor file for the SCSS is built separately to increase webpack build
  48. | performance but also to keep a cache file for visitors.
  49. |
  50. */
  51.  
  52. mix
  53. .setPublicPath('public')
  54. .sass(`${assetsDir}scss/vendors/vendors.scss`, 'public/css');
  55.  
  56. /*
  57. |--------------------------------------------------------------------------
  58. | Webpack configuration overrides
  59. |--------------------------------------------------------------------------
  60. |
  61. | By default the webpack.config.js configuration from the laravel-mix package
  62. | is being used to compile assets. We can override and extend the webpack
  63. | configuration with our own configuration here.
  64. |
  65. */
  66.  
  67. mix.webpackConfig({
  68. devServer: {
  69. overlay: true
  70. },
  71. module: {
  72. rules: [
  73. {
  74. test: /\.(vue|js)$/,
  75. loader: 'eslint-loader',
  76. enforce: 'pre',
  77. exclude: /node_modules/
  78. },
  79. {
  80. test: /\.svg$/,
  81. use: [
  82. {
  83. loader: 'raw-loader'
  84. }
  85. ]
  86. }
  87. ]
  88. },
  89. plugins: [
  90. new DashboardPlugin(),
  91. new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /nl|en|de|fr/)
  92. ],
  93. resolve: {
  94. modules: [
  95. path.resolve('./'),
  96. path.resolve('./node_modules')
  97. ]
  98. }
  99. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement