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]' | |
}) | |
} | |
} |
Dude, you saved my life!
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
I'm not sure what you want to achieve. This is related to add a pdf loader in a project using vue-cli. As the project itself does not have a webpack config file you have to change in the vue.config.js file. Is not required to do anything on babel.config.js