When moved to production, with enabled js file bundling, i start to get these types of errors in browser console:
Refused to execute script from 'http://ultra.com/static/frontend/RocketTeam/ultra/ru_RU/requirejs/require.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Well, i check my files and it seems like i have them all in pub/static folder. So, for this
http://ultra.com/static/frontend/RocketTeam/ultra/ru_RU/requirejs/require.min.js i have a file in my filesystem here:
When i try to reach these files via links from the browser console, i get 404.
As i understand my server returns me the wrong MIME type for js files. But why this happens? In developer mode everything works fine.
I just executed
php bin/magento deploy:mode:set production and had output in the console similar to what is shown in documentation.
Magento 2.2 running locally in a docker container, php 7.0.18
UPD: Ok, i was stupid, i don't have minified version of files in my filesystem. Ok, but why minification didn't happen?
UPD: Thanks to @PramodKharade, i managed to make it work. What i did was:
after switching to production mode i cleaned and flushed caches, deleted generated folders, ran the setup, compiled code, and deployed static content:
- rm -rf pub/static/*
- rm -rf var
- php bin/magento c:c
- php bin/magento c:f
- php bin/magento set:up
- php bin/magento setup:di:compile
- php bin/magento setup:static-content:deploy --language ru_RU