Jigsaw: Prevent transpiling of JS

Created on 16 Mar 2021  路  3Comments  路  Source: tighten/jigsaw

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

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathangross picture nathangross  路  3Comments

pablood85 picture pablood85  路  8Comments

luklus picture luklus  路  11Comments

dirkolbrich picture dirkolbrich  路  13Comments

GenieTim picture GenieTim  路  4Comments