Compile multiple js files
See original GitHub issueI have an app that uses two different javascript files based on how the site is entered. I have my mix files set up like below. However, whenever I try to compile it the second .js() just overwrites the first file regardless of where the output path is set to.
let mix = require('laravel-mix').mix;
mix.js('resources/assets/js/app.js', 'public/js')
.extract(['vue','lodash','axios','moment'], 'public/js/vendor.js')
.js('resources/assets/js/scanner/app.js', 'public/js/scanner/app.js')
.copy('resources/assets/js/scanner/eb', 'public/js/scanner/eb');
Here is the output from the terminal:
DONE Compiled successfully in 3104ms
Asset Size Chunks Chunk Names
js/scanner/eb/eb.navbar.js 758 bytes [emitted]
/js/app.js 1.21 MB 0 [emitted] [big] app
js/scanner/eb/eb.audiocapture.js 2.78 kB [emitted]
js/scanner/eb/eb.camera.js 5.19 kB [emitted]
js/scanner/eb/eb.application.js 4.37 kB [emitted]
js/scanner/eb/eb.cardreader.js 2.98 kB [emitted]
js/scanner/eb/eb.barcode.js 25.8 kB [emitted]
js/scanner/eb/eb.battery.js 1.55 kB [emitted]
js/scanner/eb/eb.connectionchecking.js 772 bytes [emitted]
js/scanner/eb/eb.database.js 2.17 kB [emitted]
js/scanner/eb/eb.device.js 1.1 kB [emitted]
js/scanner/eb/eb.database.sqlite3.js 1.48 kB [emitted]
js/scanner/eb/eb.instrumentation.js 3.48 kB [emitted]
js/scanner/eb/eb.intent.js 922 bytes [emitted]
js/scanner/eb/eb.keystate.js 711 bytes [emitted]
js/scanner/eb/eb.log.js 1.78 kB [emitted]
js/scanner/eb/eb.keycapture.js 927 bytes [emitted]
js/scanner/eb/eb.mediaplayer.js 1.09 kB [emitted]
js/scanner/eb/eb.logcapture.js 962 bytes [emitted]
js/scanner/eb/eb.nativemenubar.js 776 bytes [emitted]
js/scanner/eb/eb.nativetabbar.js 1.15 kB [emitted]
mix-manifest.json 32 bytes [emitted]
js/scanner/eb/eb.nativetoolbar.js 977 bytes [emitted]
js/scanner/eb/eb.notification.js 1.13 kB [emitted]
js/scanner/eb/eb.network.js 2.19 kB [emitted]
js/scanner/eb/eb.printer.js 6.31 kB [emitted]
js/scanner/eb/eb.printerzebra.js 10.2 kB [emitted]
js/scanner/eb/eb.push.js 3.21 kB [emitted]
js/scanner/eb/eb.rhofile.js 2.28 kB [emitted]
js/scanner/eb/eb.screenorientation.js 1.02 kB [emitted]
js/scanner/eb/eb.sensor.js 2.34 kB [emitted]
js/scanner/eb/eb.signature.js 1.63 kB [emitted]
js/scanner/eb/eb.smartcradle.js 1.71 kB [emitted]
js/scanner/eb/eb.system.process.js 900 bytes [emitted]
js/scanner/eb/eb.timer.js 839 bytes [emitted]
js/scanner/eb/eb.system.js 4.52 kB [emitted]
js/scanner/eb/eb.webview.js 1.96 kB [emitted]
js/scanner/eb/eb.signalindicators.js 1.04 kB [emitted]
js/scanner/eb/ebapi.js 13.7 kB [emitted]
js/scanner/eb/ebapi-modules.js 204 kB [emitted]
js/scanner/eb/scanner.css 308 bytes [emitted]
js/scanner/eb/elements.js 142 kB [emitted]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Combine multiple JavaScript files into one JS file [closed]
Files can be easily combined using the command cat *.js > main.js and main.js can then be run through the YUI compressor using...
Read more >The Best Way to Compile Multiple Javascript Files Into One
The Best Way to Compile Multiple Javascript Files Into One · use a build system like Grunt / Gulp + Concat · have...
Read more >How do you 'merge' several JS files into one? [closed]
Use a javascript bundler to combine many smaller scripts into a custom file per page. This is more complicated, but allows you to...
Read more >Running mix for multiple javascript files - Laracasts
I want to compile multiple JS files using Laravel Mix and also make them generate as separated files. Right now they are all...
Read more >Combine Multiple JavaScript Files - Mobile Website Book
Combine Multiple JavaScript Files into One File · Open all 3 JavaScript files. · Copy and paste all the content of the 3...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This can be done by following way:
Above code will create three folders in public directory name admin, app, common with CSS and JS folders.
Now you can use them in different master layouts for admin panel and front-end.
…
Disregard my question, actually it works the issue was in my code 😃