Answer the question
In order to leave comments, you need to log in
How to configure the project to run from the root folder and not from the public/ folder?
I want the project to be launched from their root folder, and the css and js files were in the public folder
and these errors are also in the console
[webpack-dev-server] FD3-Pauls\keep\public' directory
[webpack-dev-server] 404s will fallback to '/index.html'
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const extractCSS = new MiniCssExtractPlugin();
<code>module.exports = {
entry: "./src/index.js", // основной файл приложения
output: {
path: __dirname + '/public/',
filename: "bundle.js"
// path: __dirname + "/public/build", // путь к каталогу выходных файлов
//filename: "bundle.js", // название создаваемого файла
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/, // какие файлы обрабатывать
exclude: [/node_modules/, /public/], // какие файлы пропускать
use: { loader: "babel-loader" }
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
}
]
},
plugins: [
extractCSS,
new HtmlWebpackPlugin({
template: __dirname + '/index.html', //your template file
filename: 'index.html',
})
],
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
}
}</code>
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