react-hot-loader-starter-kit icon indicating copy to clipboard operation
react-hot-loader-starter-kit copied to clipboard

webpack loaders right way

Open spac3unit opened this issue 8 years ago • 1 comments

Hello. Can you provide some info about using loaders in webpack configs? I trying to load png and jpg files in my component: import image from "../../assets/cover.png" and have error: Unexpected character '�' (1:0)

i tried with url-loader and file-loader in my webpack/developement.js and webpack/production.js, like this:

{
        test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: "file-loader",
            options: {}
          }
        ]
}

Thx!

spac3unit avatar Jan 06 '18 21:01 spac3unit

That'll need Webpack operating on the server side code too (or a Babel plugin), to deal with any requires for things that aren't JavaScript (like images and CSS). At the minute it's set up for the simple case where we're just dealing with JavaScript, but maybe not that's not so realistic, so we'll get this done.

earnubs avatar Jan 06 '18 23:01 earnubs