I am trying to work with webpack and PHP.
Proxying to the embedded PHP web server works, but it loses the ability to monitor changes in index.php and other PHP files. Viewing js files works correctly.
Package.json
"devDependencies": {
"webpack": "^2.1.0-beta.21",
"webpack-dev-server": "^1.15.0"
},
"scripts": {
"backend": "cd src && php -S localhost:9000",
"server": "webpack-dev-server --inline --colors --progress --display-error-details --display-cached --port 3000 --content-base src",
"start": "start npm run backend && start npm run server"
}
webpack.config.js
devServer: {
proxy: {
'/': {
target: {
host: "localhost",
port: 9000,
protocol: "http"
}
}
},
},
watch: true,
Without a proxy server, working with the clock and layout function (in the index.html file) is performed correctly.
How can I tell the webpack-dev server to explicitly view php files?
Perhaps the way I use to proxy PHP is wrong or too complicated? I would like to hear other solutions.
thank
source
share