Are you planning on adding guides for using laravel-mix as a standalone replacement for webpack, without requiring you to download all of laravel?
I'm asking because I'm not a PHP dev but I'd really like to use laravel-mix in my front-end stack, and I'm struggling to find documentation for how to efficiently achieve that.
You can check this repo: https://github.com/laravelista/laravel-mix-without-laravel
There's a quick guide here: https://github.com/JeffreyWay/laravel-mix/blob/master/docs/installation.md
@JeffreyWay I tried following the instructions, but i get an error upon running npm run dev.
No configuration file found and no output filename configured via CLI option.
A configuration file could be named 'webpack.config.js' in the current directory.
Use --help to display the CLI options.
I'm on windows 7 _(due to work, I'm used to ubuntu, so this might just require a trivial solution)_
@Olian04 I had the same error when upgrading from v0.12.1. There is no more webpack.config.js file produced when following the stand-alone installation instructions since it's not meant to be editable, so if you try to run the previous NPM scripts it errors over a config file not existing. This worked for me: update your scripts in package.json to the following:
"scripts": {
"dev": "NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
When the script runs it will refer to the webpack.config.js file in node_modules/laravel-mix/setup.
It's really the same no matter the backend. I use it in several projects that don't use laravel. You just have to make sure your paths are set correctly. Actually I usually add a resources folder and mimic the asset structure of Laravel.
Hi ! @JeffreyWay
Maybe there is a slight problem in the documentation: https://github.com/JeffreyWay/laravel-mix/blob/master/docs/installation.md

When I run node_modules/.bin/webpack, I got this:

So, I can only add the following NPM scripts to my package.json file, and run npm run dev.
"scripts": {
"dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
Thanks a lot !
Most helpful comment
@Olian04 I had the same error when upgrading from v0.12.1. There is no more
webpack.config.jsfile produced when following the stand-alone installation instructions since it's not meant to be editable, so if you try to run the previous NPM scripts it errors over a config file not existing. This worked for me: update your scripts inpackage.jsonto the following:When the script runs it will refer to the
webpack.config.jsfile innode_modules/laravel-mix/setup.