samedi 1 avril 2017

Laravel Mix scripts() has no effect

I am using Laravel 5.4.

I am trying to copy every single node_modules vendor file in a single vendor.js, however I am having some difficulties at making mix.scripts() work in my webpack.mix.js configuration file.

webpack.mix.js

const { mix } = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/assets/js/app.js', 'public/js');

mix.copy('node_modules/pickadate/lib/themes/classic.css',      'public/css/vendor/pickadate/themes/classic.css');
mix.copy('node_modules/pickadate/lib/themes/classic.date.css', 'public/css/vendor/pickadate/themes/classic.date.css');

mix.scripts([
    'node_modules/pickadate/lib/picker.js',
    'node_modules/pickadate/lib/picker.date.js'
], 'public/js/vendor.js');

mix.sass('resources/assets/sass/app.scss', 'public/css/app.css');
mix.sass('resources/assets/css/lorde.css', 'public/css/lorde.css');

mix.options({
  processCssUrls: false
});

This is what appears on console:

                                   Asset         Size  Chunks                     Chunk Names
                              /js/app.js      1.23 MB       0   [emitted]  [big]  /js/app
                            /css/app.css       128 kB       0   [emitted]         /js/app
                          /css/lorde.css      8.75 kB       0   [emitted]         /js/app
                       mix-manifest.json    104 bytes           [emitted]
 css/vendor/pickadate/themes/classic.css      2.76 kB           [emitted]
 css/vendor/pickadate/themes/classic.date.css 6.04 kB           [emitted]

You can see that vendor.js (the file I am trying to build) is ignored completely.

How do I fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire