It turned out both problems were actually the same thing. Problem 1 was caused by the files not being in ES5, so I added
mix.webpackConfig({
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules(?!\/foundation-sites)|bower_components/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
}
});
Now I don't need mix.babel() anymore, and I can just run .version() on the generated files. Sometimes writing down what the exact problem is helps a lot solving it all by yourself. I'll leave this up here in case someone else runs into the same problem.