Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

javascript - Getting unwanted base64 when require('image.dir')

I have a project structure with two separate folders, one for the backend and the other one for the frontend. I'm trying to generate PDFs with an image inside comming from the public file of the frontend. I'm getting it with my actual image path put into a require('').

    getImagesRequire(state) {
        state.images.forEach( el => {
            el.src = require(`@/assets/${el.dir}`)
        })
        return state.images;
    }

It's working perfectly for all images in that list but one, when that original path is sent through the require('') it's returning the base64 code of the image, and I don't understand where it's coming from. I'm thinking maybe it comes from the file but it's png like every other image file... Any insight welcome


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...