How To Add Support For Pdf Files With Vue Cli 3?
I need to configure Webpack to accept and handle PDF files with url-loader via the Vue Cli (latest). vue.config.js module.exports = { configureWebpack: { rules: [ {
Solution 1:
Turns out, I was missing another level for the rules
array.
module: {}
So it should be in full:
module.exports= {
configureWebpack: {
module: {
rules: [
{
test:/\.(pdf)(\?.*)?$/,
use: [
{
loader:'url-loader',
options: {
name:'files/[name].[hash:8].[ext]'
}
}
]
}
]
}
}
}
My bad! Hopefully this helps someone out there.
Solution 2:
For coffeescript
and vue-cli
version 3, I needed to npm install -D coffee-loader
and then create this file as vue.config.js
:
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.coffee$/,
use: [
{
loader: 'coffee-loader',
options: {
sourceMap: true
}
}
]
}
]
}
}
}
Post a Comment for "How To Add Support For Pdf Files With Vue Cli 3?"