score:3

Accepted answer

include it in the file loader, as you do with images:

{ test: /\.(jpg|png|gif|svg|pdf)$/, use: [ { loader: 'file-loader', options: { name: '[name].[ext]', outputpath: './assets/images/' } } ] },

note that i have added |pdf after the svg declaration. webpack should then process the file as it does with images.

score:0

config.module.rules.push({
    test: /\.pdf$/,
    use: {
        loader: 'file-loader',
        options: {
            name: '[path][name].[ext]',
        },
    },
});

// vue.config.js configurewebpack 
config.module
    .rule('pdf')
    .test(/\.pdf$/)
    .use('pdf')
    .loader('file-loader')
    .end();

config.module
    .rule('pdf')
    .test(/\.pdf$/)
    .use('file-loader?name=[path][name].[ext]')
    .loader('file-loader')
    .end();

Related Query

More Query from same tag