see my website here
ddaaggeett / podware-legacy Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
i'm using file-loader with webpack 4
in one of my react.jsx
files, i call an image module: <img src={require(../relative/path/images/image.png)} />
and after building with webpack, the asset gets bundled (as expected) to an image.png
file in the build/images/
directory.
after the build, i can see the image.png
file itself bundled to the exact location i'm intending, yet my browser is spitting out to me the error:
GET file:///build/images/image.png
net::ERR_FILE_NOT_FOUND
/build/images/image.png:1
the bundled assets even display in the webpack output contained in the build/
public directory:
...
Asset Size Chunks Chunk Names
images/image.png 39.6 KiB [emitted]
bundle.js 631 KiB main [emitted] main
bundle.css 513 bytes main [emitted] main
...
here's the relevant portion of my webpack.config.js
file
module.exports = {
...
output: {
path: path.resolve(__dirname, 'build'),
publicPath: '/build/',
filename: 'bundle.js'
},
module: {
rules: [
...
{
test: /\.(png|jpg)$/,
use: [
{
loader: 'file-loader',
query: {
name: '[name].[ext]',
publicPath: '/build/',
outputPath: 'images/',
}
}
]
}
...
]
...
}
}
i've read the webpack documentation on bundling output files pertaining to the basics i require and have exhausted tutorials on loading image files using file-loader, but for the life of me cannot get the image file loading in the browser.
please help!
i can only imagine the godsend if @sokra or @d3viant0ne themselves went out of their way to spark/share this issue :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.