Is there any way to run with Vite instead of Webpack? #6256
Unanswered
cesar-zavala-grata
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So we started to build an Add-in, but we started with webpack, and we have seen these kinds of errors:

(This image is not mine; it is from this question: https://stackoverflow.com/questions/76928704/excel-add-in-with-shared-runtime-unhandled-exception-on-displaydialogasync, but technically, we have the same issue.)
And also, Webpack, every time we do an update, takes around 9 seconds to refresh the change; we even have to do a forced update with "Right Click > Update"
So we thought that maybe working with Vite would allow us to develop faster, easier, and better, but we're not really sure how to achieve that.
I started to check this repo:
https://github.com/ExtraBB/Office-Addin-React-Vite-Template
But that one does not support Custom Functions, and we do (commands, custom functions, and taskpane)
And then tried to use some AI help to try to reach it... (but obviously first tried "manually") but nothing seems to work...
With the attached config (at the bottom), everything started to load in the browser, but there is only one thing I notice between Webpack and Vite with these settings, in Webpack I don't see an error stating "OfficeRuntime is undefined" but with Vite I do...
So maybe there is something that I'm missing... (could be that in webpack there is a "copy" that pulls the "JS from the customs.js, which includes that?)", performed a comparison of the "dist/taskpane.html" file vs the vite dist file, and everything looks the same in short... and the add-in is being loaded without further errors in Excel, but once I open the task pane, it states "Error loading the add-in" and I'm unable to debug anything, there are no errors on
OfficeAddins.log.txtand since I can't open the Inspector for WebView I'm unable to see anything (I'm running in Windows, Office 365 subscription), tried with Web version but also, loads but does nothing and console shows no errors (tried withnpm run start -- web --document {url})So in general:
We have: Custom Functions, Ribbon (Commands), and Task Pane
We use Shared Runtime
It's Excel only
Manifest is valid (
npm run validate)We're on Windows
Using an Office 365 subscription
We're trying to use Vite instead of Webpack
Here is the vite.config.ts that I worked with some AI help...
Beta Was this translation helpful? Give feedback.
All reactions