Добрый день.
Пытаюсь настроить webpack для wordpress.
Структура проекта
weback.config.js
const path = require("path");
const miniCss = require('mini-css-extract-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const config = {
mode: 'development',
context: path.resolve(__dirname, 'src'),
entry: {
main: './index.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
publicPath: '/build/'
},
plugins: [
new BrowserSyncPlugin({
files: [
"**/*.php",
"src/scss/**/*.scss",
"src/js/**/*.js",
],
proxy: "http://localhost:10008/", // your dev server here
open: false
}),
new miniCss({
filename: 'css/main.css',
}),
new CleanWebpackPlugin()
],
module: {
rules: [
{
test: /.(s*)css$/,
use: [
miniCss.loader,
'css-loader',
'sass-loader',
]
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
use: {
loader: "file-loader"
}
},
]
}
};
// Export the config object.
module.exports = config;
Создал на странице тестовый блок some и прописал в стилях
.some {
width: 8rem;
height: 8rem;
background: url('./../i/product.png') no-repeat center;
border: 1px solid red;
}
И в браузере получается такой url к картинке
background: url(file:///build/21bceb7a428e4289503f.png) no-repeat center;
Как получить адекватный url?