Created
July 10, 2019 02:39
-
-
Save aquilesb/f65bda1a8f96e82f73e6f95cedb09625 to your computer and use it in GitHub Desktop.
How to add pdf loader to vue-cli's project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
chainWebpack: config => { | |
config.module.rule('pdf') | |
.test(/\.(pdf)(\?.*)?$/) | |
.use('file-loader') | |
.loader('file-loader') | |
.options({ | |
name: 'assets/pdf/[name].[hash:8].[ext]' | |
}) | |
} | |
} |
I added the code you wrote but it isn't working
Here's what my config file looks like
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
chainWebpack: config => {
config.module.rule('pdf')
.test(/\.(pdf)(\?.*)?$/)
.use('file-loader')
.loader('file-loader')
.options({
name: 'assets/pdf/[name].[hash:8].[ext]'
})
}
})
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dude, you saved my life!