webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 257 forks source link

images was damaged after the build #330

Closed coocssweb closed 5 years ago

coocssweb commented 5 years ago

Images was damaged after the build. and the photo can't even preview.

Recently, i update babel to 6.7.7, webpack to 4.30.0, file-loader to 3.0.1, url-loader to 1.1.2, cause this bug, and i can't solve it. Can you take a moment to help.

Code

Here is the webpack.config.js link github link

{
    test: /\.(png|jpg|gif|svg)$/,
    loader: 'url-loader',
    query: {
        limit: 1,
        publicPath: '',
        name: `../images/[name].[hash:8].[ext]`
    }
},
{
    test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
    loader: 'file-loader',
    query: {
        publicPath: '',
        name: `../fonts/[name].[hash:8].[ext]`
    }
}

How Do We Reproduce?

clone my repositories, build it, and the image path is 'dist/images/*'

// install
npm install

// build
npm run build
coocssweb commented 5 years ago

I’m realy sorry. I found the reason why images damage, it is my webpack-copyright-plugin sign the image files and cause the image files coding error. I try to reconfiguration webpack.config.js. Finally, resolve it. If it bring you confusion, I sorry.