Hi All,
Apologies if this is a simple problem but I couldn't find anything in the docs to help point me in the right direction.
I'm looking to start developing in ES6 however I notice that Webpack? Appears to transpile the JS in the output JS file, together with a load of other bits. Is it possible to disable this in order to keep the output JS as pure and simple as possible to aid debugging - just my application JS and nothing else? I don't have any need to support older browsers :)
Thanks in advance!
Edit: Terminology
Well I answered my own question which has partially corrected the problem.
Appending the following to my webpack.mix.js
.babelConfig({
only: ["./some-fake-dir"]
})
Source: https://stackoverflow.com/questions/48034838/use-laravel-mix-without-es6-compilation
Feels a bit 'Hacky' but it works, however it looks like Webpack is also adding additional JS in there, but my JS is cleaner than before at least :)
Sorry to spam this thread. I just found a cleaner solution for anyone interested.
use mix.combine('source/file.js', 'full/output/path/to/file.js'); or mix.combine(['source/file1.js, source/file2.js'], 'full/path/to/file.js');
Instead, this will prevent Babel and Webpack from touching your JS source :)
The 2nd solution is the one I'd recommend (mix.scripts is another option). By default, Mix runs anything compiled with the .js directive through compiling ES6 2015, module bundling, minification, and concatenation. Avoiding that by using the .scripts command is documented in the Mix docs here.
Most helpful comment
The 2nd solution is the one I'd recommend (
mix.scriptsis another option). By default, Mix runs anything compiled with the.jsdirective through compiling ES6 2015, module bundling, minification, and concatenation. Avoiding that by using the.scriptscommand is documented in the Mix docs here.