environment variables inside "webpack.mix.js" doesnt work anymore
See original GitHub issue- Laravel Mix Version: v1.4.2
- Node Version v8.4.0
- NPM Version v5.3.0
- OS: OSX 10.11.6
Description:
using an evn variable no longer works on assets compilation, on older version of mix 0.11.4 it was working correctly.
Steps To Reproduce:
- create a new folder and name it something like “resources/bulma/xxx.scss”
- make an env var equal to that name “MIX_MM_FRAMEWORK=bulma”
- compile against the env var name
mix.sass('resources/' + process.env.MIX_MM_FRAMEWORK + '/xxx.scss', 'public/assets/vendor/style.css')
.version()
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Passing in environment variables after upgrade to Laravel MIX 6
The problem is, that I cannot access the environment variable in webpack.mix.js anymore via process.env.ENV_FILE . Its value is undefined... I ...
Read more >Mix environment variable in vanilla javascript - Laracasts
In webpack.mix.js I am using mix.scripts() to compile different JS files together. ... but when I use mix.js() my JS code doesn't work...
Read more >MiniCssExtractPlugin - webpack
It creates a CSS file per JS file which contains CSS. It supports On-Demand-Loading of CSS and SourceMaps. It builds on top of...
Read more >Moving A Laravel Webpack Project To Vite - TechvBlogs
Vite only supports ES modules, so require doesn't work anymore, and you need to import modules now in your scripts. Example - not...
Read more >The Mix CLI | Laravel Mix Documentation
Compiling in a Local Environment. To build assets for development, reach for the npx mix command. Mix will then read your webpack.mix.js configuration...
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
@ctf0 BTW it looks like all you need to do is use the
dotenv
package yourself (already installed by Mix). For example, here’s how i’m using it to define the Browsersync proxy URL for a WordPress theme:I could i never realize that just using process.env.APP_URL works! I’m using laravel-mix v4, no need to require dotenv