CoffeeScript was supported in Laravel Elixir, and so, I wrote a lot of CoffeeScript. Now, when I run npm run dev, I get an error that says (...) .coffee is not a function. Is there no support for CoffeeScript in Laravel Mix?
Correct. The mix file lists every method that's available.
https://github.com/JeffreyWay/laravel-mix/blob/master/setup/webpack.mix.js#L17-L31
To add coffeescript support, you'd have to do it the standard way that's done with webpack, which most likely involves finding a coffeescript loader and adding it to modules.rules.
Thank you for the info, @QWp6t!
Well, that's.... facepalm-worthy. I mean, support for a whole language out the window and I really can't see why in this particular instance. At least, I hope there is support for CoffeeScript planned in the future.
Not many folks use CoffeeScript these days. It was removed in Laravel Elixir as well about six months ago.
You can of course copy our webpack.config.js file to your project root, and add support yourself.
Thanks a friggin bunch for hanging those that do use it out to dry. You yourself maintained a CoffeeScript addon-module for Elixir, so there was support for CoffeeScript right up to the moment you released Mix.
May I suggest preparing the community before you drop support like this next time?
Huh? How'd I hang you out to dry by releasing a tool that had never supported Coffeescript compilation?
Just use Laravel Elixir, or spend five minutes manually adding support to your webpack.config.js file.
Sheesh.
My apologies, @JeffreyWay
I've been having a really bad time today trying to migrate from gulp and Elixir to webpack and Mix. I do make it a point to stay current with new Laravel releases as much as I can. Since Mix is the new Elixir, I of course wanted to try and migrate so as not to stay 'locked in' with Elixir. Being told coffeescript-support is - and will not be part of Mix, only added to my frustrations.
Five minutes? I'm sure, you could do it in that time (which makes it a little strange why those five minutes weren't spent when coding Mix, really), but I certainly can't - I've been trying.
I apologize again for venting my frustrations here. You deserve better, Jeffrey.
which makes it a little strange why those five minutes weren't spent when coding Mix, really
Not strange at all. CoffeeScript support wasn't included for the same reason why Stylus, Typescript, etc. also weren't included. Every new preprocessor adds bloat to Mix, and increases the number of dependencies that folks must download.
Here's how to add CoffeeScript support in thirty seconds.
// npm install coffee-loader coffee-script
mix.js('resources/assets/js/app.coffee', 'public/js')
.webpackConfig({
module: {
rules: [
{ test: /\.coffee$/, loader: 'coffee-loader' }
]
}
});
Most helpful comment
Not strange at all. CoffeeScript support wasn't included for the same reason why Stylus, Typescript, etc. also weren't included. Every new preprocessor adds bloat to Mix, and increases the number of dependencies that folks must download.
Here's how to add CoffeeScript support in thirty seconds.