Giter Site home page Giter Site logo

podware-legacy's Introduction

podware-legacy's People

Contributors

ddaaggeett avatar

Watchers

 avatar  avatar

podware-legacy's Issues

webpack file-loader: file not found in bundle, but file exists where/as expected upon build

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 :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.