versioning doesn't work when called inside of an if(production) conditionnal
See original GitHub issueUsing ^7.0
This works
mix.combine([
'resources/assets/landing/css/devices/style.css',
'resources/assets/landing/css/animate.css',
], 'public/dist/app.css').version();
mix.combine([
'resources/assets/landing/js/main.js',
'resources/assets/landing/vendor/push-menu/js/jasny-bootstrap.min.js',
], 'public/dist/app.js').version();
if (mix.inProduction) {
mix.minify();
}
This doesn’t work
mix.combine([
'resources/assets/landing/css/devices/style.css',
'resources/assets/landing/css/animate.css',
], 'public/dist/app.css');
mix.combine([
'resources/assets/landing/js/main.js',
'resources/assets/landing/vendor/push-menu/js/jasny-bootstrap.min.js',
], 'public/dist/app.js');
if (mix.inProduction) {
mix.minify();
mix.version();
}
This last one never applies the versioning. I would like to only apply minification and versioning when I run npm run production, not when I run npm run dev
How can I achieve this?
In the first case, it does versioning whether I run dev or production
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How can I conditionally import an ES6 module? - Stack Overflow
You can now call the import keyword as a function (i.e. import() ) to load a module at runtime. It returns a Promise...
Read more >Everything you wanted to know about the if statement
In this article. Conditional execution; The if statement; Comparison operators; Collection operators; Logical operators; Bitwise operators ...
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >Using version control and deploying | Looker - Google Cloud
You can make your fix in the new branch, and then deploy that branch's changes to production — before resuming work in your...
Read more >Handling common JavaScript problems - MDN Web Docs
If you want this to work correctly, you can define a function to add the handler separately, calling it on each iteration and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
mix
used inwebpack.mix.js
is not an instance ofMix
but a entry to specify webpack config. You should useUsing the latest version 1.7.2, I believe this has changed again. I had to use the following to apply versioning to production.