-
-
Notifications
You must be signed in to change notification settings - Fork 609
Closed
Description
I'm trying to add a background image to the body element. When compiled it says that the image cannot be found (404).
I have tried all steps in this issue:
#256
Below is my config file
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
main: './src/js/main.js',
firebaseui: './src/js/auth/firebaseui.js',
},
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.(sa|sc|c)ss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader?url=false', 'sass-loader'],
},
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'images',
},
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/[name].css',
}),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html',
chunks: ['firebaseui'],
}),
new HtmlWebpackPlugin({
filename: 'dashboard.html',
template: './src/dashboard.html',
chunks: ['main'],
}),
],
};
My scss file
@import './bulma';
body {
background-image: url('../images/money-exchange.jpg');
}
Can anyone suggest me a solution? Thanks
Metadata
Metadata
Assignees
Labels
No labels