OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
837 stars 208 forks source link

Adding New Images inside Asset Folder - Yeoman Generator Office Addin #670

Closed 12sameera closed 2 years ago

12sameera commented 3 years ago

I added few images inside the asset folder for an office-addin which i generated using yeoman generator. But it always throws images not found exception. Only the images which were there during the addin generation are shown. How to solve this issue?

millerds commented 3 years ago

Anything you add to the project needs to be deployed by webpack for testing. Webpack will automatically deploy assets (images) linked to in the html and code files it's deploying (like taskpane.html). However this doesn't happen for the manifest.xml file (I'm assuming that's where you are referencing the new images). You need to add a pattern for you're new images to the CopyWebpackPlugin settings in the webpack.config.json file.

12sameera commented 3 years ago

Thank you very much. I was able to solve the problem thanks to your valuable guidance. new CopyWebpackPlugin({ patterns: [ { from: "assets/", to: "assets/", }, ], }),

12sameera commented 3 years ago

Sorry to disturb you. I am getting an error favicon not found.

image

I have already added an .ico file in my assets folder and it has been copied to dest/asset folder as well. Why i am still getting this error?

millerds commented 3 years ago

I've always seen that error (even in the default project output) and I don't know where it's even being referenced in the code. I haven't taken the time to figure it out, but where ever it's being referenced from might not be looking in the assets folder.