Answer the question
In order to leave comments, you need to log in
How to start webpack-dev-server with livereload frontend and php on backend?
There is a project on Svelte.js and php as a backend ... so things have already developed.
The project is built by webpack based on the default webpack svelte template provided.
PHP in the project is still static.
Everything is going well and even with livereload takes off, everything is fine.
Except that php won't start under webpack-dev-server.
PHP 7 is installed on the computer.
I suspect that either some additional package is needed, or the webpack-dev-server setting is needed.
But Google and Yandex still do not give an answer to the question of what is missing in my config, so that without iis and apache (and others like them) `npm run dev` would be enough to launch a project with php backend support and livereload on client.
resolve: {
alias: {
svelte: path.resolve('node_modules', 'svelte')
},
extensions: ['.mjs', '.js', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main']
},
output: {
path: __dirname + '/public',
filename: '[name].js',
chunkFilename: '[name].[id].js'
},
module: {
rules: [
{
test: /\.svelte$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
emitCss: true,
hotReload: true,
dev: true
}
}
},
{
test: /\.css$/,
use: [
prod ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader'
]
}
]
},
mode,
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css'
})
],
devtool: prod ? false: 'source-map'
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