Так что я сделал, как он говорит, у меня есть index.html в корне моего проекта, затем я пытаюсь загрузить изображение из моего файла scss.
Теперь у меня 2 ошибки: 1) от Консоль Chrome: не удается найти модуль «./img/header.jpg». 2) с моего терминала:
Код: Выделить всё
ERROR in ./~/css-loader!./~/sass-loader!./~/resolve-url-loader!./public/css/header.scss
Module not found: Error: Cannot resolve 'file' or 'directory' ./img/header.jpg in C:\Web-Development\React\Portfolio\public\css
@ ./~/css-loader!./~/sass-loader!./~/resolve-url-loader!./public/css/header.scss 6:64-91
Код: Выделить всё
module.exports = {
entry: './main.jsx',
output: {
filename: './public/js/build/bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['react', 'es2015']
}
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass", "resolve-url"]
},
{
test: /\.jpg$/,
loader: "file?name=[path][name].[ext]"
}
]
}
};
ОБНОВЛЕНИЕ:
Я установил загрузчик файлов и следовал инструкциям, теперь я получаю эту ошибку в консоли: GET http://localhost:3000/public/img/header.jpg 404 (не найден) – jquery.js:9119
Подробнее здесь: https://stackoverflow.com/questions/339 ... ind-images
Мобильная версия