-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot reload doesn't work with custom functions #157
Comments
I've progressed this issue but am now hung up on the following error:
Haven't been able to get around it. It would be great to have an example using custom functions in this repo. |
Hi @sheldoncoates, Sorry to hear you're having issues. @MiaofeiWang, could you please investigate? |
hey @AlexJerabek @MiaofeiWang - I actually sorted this out. It was an issue with webpack when merging the two |
There was an issue in custom-functions-metadata package which could result in this which was fixed. The Office-Addin-TaskPane-React project has been updated so it should not occur. But there is a potential that other problems could occur with hot reloading, so please raise any issues you encounter. |
I'm running into this issue again for some reason.
And
My prod builds seem fine it's just the hot reload thats cooked. I can share webpack config if needed just let me know. |
Maybe related: 158 |
Hi @Rick-Kirkham I went through the issue after the Is there anyway we can get a full working webpack for custom functions with a working taskpane + hot reload React 18? Thanks |
That last error is with the taskpane and not custom functions. I'm not sure custom functions are compatible with hot reloading in general. They are run in a JS only runtime that I believe requires ES5 syntax and I believe hot reloading and webpack use a more modern syntax that would break custom functions. This is why the custom functions project serves up the dist folder directly and the manifest points to that file (i.e. localhost:3000/public/functions.js) so that webpack doesn't inject its own incompatible code. The taskpane should be configurable for hot reloading, but the function shouldn't be part of that. Note . . . creating templates for each combination of features and frameworks quickly becomes very large and hard to maintain. We provide basic examples of functionality, a bit of guidance, and a bit of help to figure out problems, but leave it up to developers to apply thing to their personal setup an requirements. |
@millerds ive tried to get this to work based on this thread and the function repo and the other issues linked here and although I can hot reload my taskpane now - my custom functions no longer work (not sure if this is specific to the mac client because online using chrome seems to work).
To get the function working as expected the following works:
but this breaks hot reload, can you please guide me to the correct webpack configuration to have this work as expected? Thanks. |
It would depend on what's in the manifest (and possibly what's in the two html files). |
My manifest is identical to this OfficeDev/Excel-Custom-Functions@7671007 prior to the revert - it uses the shared runtime.
which other html file are you referring too? i dont use commands |
ive also noticed that when i have my webpack as follows:
I get the error on taskpane code change:
but if a remove the change to the taskpane code, save, make the change again, save - hot reload works? |
If you are using the shared runtime then you should be using https://github.com/OfficeDev/Excel-Custom-Functions-Shared as a model. The html files I'm referring to are taskpane.html and functions.html. The manifest has settings that indicate which files to use for custom functions. The shared runtime template was designed to use taskpane.html as the functions html so when you change that in webpack the manifest also needs to be updated to look for the other one. Also note that the entry point for the taskpane code in webpack includes the html file . . . this is to trigger hot reloading related to that file. None of the entry points you have include the functions html file so hot reloading isn't triggered for that file. |
Hot reload breaks when you have custom functions.
Expected behavior
Hot reload works and doesn't show a custom function error.
Current behavior
I've taken the
webpack.config.js
in this repo and added the necessary pieces to it from Excel-Custom-Functions in order to get custom functions to work since the webpacks seem to be out of sync.For some reason when hot reload happens I get an error along the lines of:
TS2304: Cannot find name 'CUSTOMFUNCTION'.
Pointing to various typescript files of no relation to the custom function code.
Steps to Reproduce
webpack.config.js
in order to make the custom function accessibleContext
Failure Logs
TS2304: Cannot find name 'CUSTOMFUNCTION'.
The text was updated successfully, but these errors were encountered: