modify mix-manifest.json before complete versioning on production
See original GitHub issue- Laravel Mix Version: 0.11.4 (
npm list --depth=0
) - Node Version 6.10.1
- NPM Version 3.10.10
- OS: macOS Sierra (10.12.3)
# Description:
I have a lot of JS scripts that should be compiled as CSS too. All the time that we’re using laravel-mix in dev environment no problem at all. But, when we launch the application and run the npm run production
we found something:
Laravel:
Unable to locate Mix file: /css/all.css. Please check your webpack.mix.js output paths and try again.
The error persists until the command npm run production
displays the output after the compilation.
Even with the message DONE Compiled successfully
displayed in the console, Laravel was unable to locate the files generated (because they do not exists in the mix-manifest.json yet).
But, when the npm run production
was finished and displays the output:
Asset Size Chunks Chunk Names /js/app.b6aa74e460981f1fae55.js 456 kB 0 [emitted] [big] /js/app /css/app.206b204034a2b86d253b760ed61af160.css 84 bytes 0 [emitted] /js/app mix-manifest.json 120 bytes [emitted]
The error was gone and laravel can find the files.
# Steps To Reproduce:
To reproduce follow the steps:
-
In one terminal tail the mix-manifest.json file running:
tail -f mix-manifest.json
and let this terminal open -
Open another terminal and run the command
npm run production
and put the other terminal in parallel to look the file (mix-manifest.json) changes in real-time -
In my example, the script remove two parameters and only insert them after the command
npm run production
displays the output.
webpack.mix.js:
const { mix } = require('laravel-mix');
mix.combine([
'resources/assets/template/js/core/libraries/jquery.min.js',
'resources/assets/template/js/core/libraries/jquery.unserialize.js',
'resources/assets/template/js/core/libraries/bootstrap.min.js',
'resources/assets/template/js/plugins/loaders/blockui.min.js',
'resources/assets/libs/jszip-utils.js',
'resources/assets/libs/FileSaver.js',
'resources/assets/template/js/core/libraries/jquery_ui/core.min.js',
'resources/assets/template/js/core/libraries/jquery_ui/effects.min.js',
'resources/assets/template/js/core/libraries/jquery_ui/interactions.min.js',
'resources/assets/template/js/plugins/tables/datatables/datatables.min.js',
'resources/assets/template/js/plugins/tables/datatables/extensions/col_reorder.min.js',
'resources/assets/template/js/plugins/tables/datatables/extensions/pdfmake/pdfmake.min.js',
'resources/assets/template/js/plugins/tables/datatables/extensions/jszip/jszip.min.js',
'resources/assets/template/js/plugins/tables/datatables/extensions/pdfmake/vfs_fonts.min.js',
'resources/assets/template/js/plugins/tables/datatables/extensions/buttons.min.js',
'resources/assets/libs/mask.js',
'resources/assets/libs/mask.money.js',
'resources/assets/template/js/plugins/ui/prism.min.js',
'resources/assets/template/js/plugins/ui/headroom/headroom.min.js',
'resources/assets/template/js/plugins/ui/headroom/headroom_jquery.min.js',
'resources/assets/template/js/core/app.js',
'resources/assets/template/js/pages/navbar_hideable.js',
'resources/assets/template/js/core/libraries/jquery_ui/interactions.min.js',
'resources/assets/template/js/plugins/forms/selects/select2.min.js',
'resources/assets/template/js/plugins/forms/selects/select2.pt-BR.js',
'resources/assets/template/js/plugins/forms/styling/switch.min.js',
'resources/assets/template/js/plugins/notifications/pnotify.min.js',
'resources/assets/template/js/plugins/ui/moment/moment.min.js',
'resources/assets/template/js/plugins/ui/moment/moment_locales.min.js',
'resources/assets/template/js/plugins/pickers/daterangepicker.js',
'resources/assets/template/js/plugins/pickers/jquery.datetimepicker.full.min.js',
'resources/assets/template/js/plugins/uploaders/fileinput.min.js',
'resources/assets/template/js/plugins/visualization/echarts/echarts.js',
'resources/assets/template/js/plugins/export/jquery.base64.js',
'resources/assets/template/js/plugins/export/tableExport.js',
'resources/assets/template/js/plugins/export/jspdf/libs/sprintf.js',
'resources/assets/template/js/plugins/export/jspdf/jspdf.js',
'resources/assets/template/js/plugins/export/jspdf/libs/base64.js',
'resources/assets/template/js/plugins/trees/jquery.fancytree.js',
'resources/assets/template/js/plugins/sweetalert.min.js',
'resources/assets/template/js/plugins/jquery.fileDownload.js',
'resources/assets/libs/jquery.print.js'
], 'public/js/vendor.js');
mix.combine([
'resources/assets/css/datatables.css',
'resources/assets/css/sweetalert.css',
'resources/assets/css/jquery.datetimepicker.min.css'
], 'public/css/all.css');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
mix.autoload({
jquery: ['$', 'window.jQuery']
});
if (mix.config.inProduction) {
mix.version();
}`
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (7 by maintainers)
Top GitHub Comments
My fix for this issue was:
webpack.mix.js
I’m seeing this problem too on latest
laravel-mix
…I also see it updates the
mix-manifest.json
twice, in my case first it generates a mix only withjs
andscss
tasks, and then it generates the complete one with thecombine
andcopy
.In my case this time window means
+10 seconds
, which basically shows this error.