Answer the question
In order to leave comments, you need to log in
How to make mix for laravel run through docker work?
Good afternoon.
When I installed laravel locally, and I work in ubuntu, then I set the host address itself, for example laravel.local
Now I run laravel as npm run watch
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "mix --production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"browser-sync": "^2.27.7",
"browser-sync-webpack-plugin": "^2.3.0",
"cross-env": "^7.0",
"jquery": "^3.2",
"laravel-mix": "^6.0.39",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"postcss": "^8.4.4",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^12.4.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10",
"webpack": "^5.3.1",
"webpack-livereload-plugin": "^1.2.0"
}
}
const mix = require('laravel-mix');
let productionSourceMaps = false;
mix.setPublicPath('public/build')
.setResourceRoot('build')
.js('resources/js/app.js', 'js')
.sass('resources/sass/app.scss', 'css')
.version()
.options({
processCssUrls: false
})
.sourceMaps(productionSourceMaps, 'source-map')
.browserSync({
proxy: 'https://localhost:8088/',
files: [
'public/build/css/app.css', // Generated .css file
'public/build/js/app.js', // Generated .js file
'public/**/*.+(html|php)', // Generic .html and/or .php files [no specific platform]
'app/**/*.+(html|php)', // Generic .html and/or .php files [no specific platform]
'resources/views/**/*.php', // Laravel-specific view files
],
notify: {
styles: {
top: 'auto',
bottom: '0'
}
},
open: false
});
docker-compose exec node npm run watch
webpack compiled successfully
[Browsersync] Proxying: https://localhost:8088
[Browsersync] Access URLs:
------------------------------------
Local: https://localhost:3000
External: https://172.18.0.3:3000
------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
------------------------------------
[Browsersync] Watching files...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question