Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let mix = require('laravel-mix');
  2.  
  3. /*
  4.  |--------------------------------------------------------------------------
  5.  | Mix Asset Management
  6.  |--------------------------------------------------------------------------
  7.  |
  8.  | Mix provides a clean, fluent API for defining some Webpack build steps
  9.  | for your Laravel application. By default, we are compiling the Sass
  10.  | file for the application as well as bundling up all the JS files.
  11.  |
  12.  */
  13.  
  14. mix
  15.     .js('resources/assets/js/app.js', 'public/static/js')
  16.   .js('resources/assets/js/login.js', 'public/static/js')
  17.  
  18.     .sass('resources/assets/sass/app.scss', 'public/static/css')
  19.  
  20.     .copyDirectory('resources/assets/images', 'public/static/images')
  21.     .copyDirectory('resources/assets/icons', 'public/static/icons')
  22.     .copyDirectory('resources/assets/fonts', 'public/static/fonts')
  23.     .copyDirectory('node_modules/font-awesome/fonts', 'public/static/fonts')
  24.   .copyDirectory('node_modules/element-ui/lib/theme-chalk/fonts', 'public/static/fonts')
  25.  
  26.     .options({
  27.         processCssUrls: false
  28.     });
  29.  
  30. if (mix.inProduction()) {
  31.     mix.version();
  32. }
  33.  
  34. mix.disableSuccessNotifications();
  35.  
  36. Mix.listen('configReady', (webpackConfig) => {
  37.     if (Mix.isUsing('hmr')) {
  38.         // Remove leading '/' from entry keys
  39.         webpackConfig.entry = Object.keys(webpackConfig.entry).reduce((entries, entry) => {
  40.             entries[entry.replace(/^\//, '')] = webpackConfig.entry[entry];
  41.             return entries;
  42.         }, {});
  43.  
  44.         // Remove leading '/' from ExtractTextPlugin instances
  45.         webpackConfig.plugins.forEach((plugin) => {
  46.             if (plugin.constructor.name === 'ExtractTextPlugin') {
  47.                 plugin.filename = plugin.filename.replace(/^\//, '');
  48.             }
  49.         });
  50.     }
  51. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement