In case anyone needs to use CoffeeScript with Laravel Mix, here's how:
First, install coffee-loader
npm install coffee-loader --save-dev
Next, open this folder from inside your project
node_modules/laravel-mix/setup
... and copy the file webpack.config.js to the base of your project.
Next, open package.json and change the paths to the config-file listed under "scripts". It should look something like this:
"dev": "(...) --config=webpack.config.js",
"watch": "(...) --config=webpack.config.js",
"hot": "(...) --config=webpack.config.js",
"production": "(...) --config=webpack.config.js"
Now, look for these lines inside the webpack.config.js that you copied:
module.exports.module = {
rules: [
Inside the rules-array, add these lines:
{
test: /\.coffee$/,
loader: 'coffee-loader'
}
You're done. Now you can reference .coffee-files from your webpack.mix.js:
mix.js('app.coffee', 'public/js')