Всем привет
Конфиг :
const path = require("path");
const webpack = require("webpack");
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const BUILD_DIR = path.resolve(__dirname, './dist');
module.exports = {
context: path.join(__dirname, '/'),
entry: ["babel-polyfill", "./src/index.js"],
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js"
},
devServer: {
contentBase: "./dist",
// outputPath: BUILD_DIR,
// hot: true,
historyApiFallback: true
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader"
}]
},
{
test: /\.css/,
use: ['style-loader', 'css-loader']
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
},
{test: /\.(jpe?g|gif|png|svg|woff|ttf|wav|mp3)$/, loader: "file"}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./public/index.html",
filename: "./index.html"
}),
new CopyWebpackPlugin([
{from: './src/img/*', to: './dist/img'}
], {})
]
};
Cтруктура :
В коде использую так :
let imgUrl = stories[key].img ? stories[key].img : "/img/no_image.jpg";
Но мне отдает "not found".
Почему?