FYI I have done the pre-checks, none of which has solved this problem.
npm list --depth=0)node -v): 8.7.0npm -v): 5.8.0When using {{ mix('/css/app.css') }} for example in a Blade template, Laravel relies on the mix-manifest.json file to load the appropriate - potentially versioned - asset. Running the tests the manifest file gets overwritten and the application no longer works in the browser.
Note: I'm not even sure whether it's a Laravel Mix issue, so please point me to the right place if it is not.
[email protected]:barnabaskecskes/laravel-mix-manifest.gitnpm run dev and open your project in the browser and confirm you see the welcome pagenpm run tests and reload the browser - you will see an error and that the page is brokenI was having the same problem running tests. This is my solution:
package.json
...
"test": "cross-env NODE_ENV=testing mocha-webpack --webpack-config webpack.config.js --require tests/JavaScript/setup.js tests/JavaScript/**/*.spec.js"
...
Notice that I have overwritten the laravel-mix/setup/webpack.config.js file with my own. It's basically a copy of the original file but with an added section:
webpack.config.js
...
if (process.env.NODE_ENV === 'testing') {
Mix.manifest.refresh = () => {};
}
...
That fixed it for me 馃憣
I do confirm the issue using [email protected]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
I was having the same problem running tests. This is my solution:
package.json
Notice that I have overwritten the
laravel-mix/setup/webpack.config.jsfile with my own. It's basically a copy of the original file but with an added section:webpack.config.js
That fixed it for me 馃憣