Requesting Suggestions : Refactoring Plugin Code

Hi all,

I am new to figma plugin development and trying to figure out ways for practical dev related scenarios during plugin development, yet 2 topics are bothering me with my code. I would appreciate if you could share any references or suggestions on these aspects.

Background: I have a plugin that has more than 2 screens. I use webpack for bundling and the development is in ts (and i am not planning to move to react for now).

  • i am looking to use certain external npm node modules and leverage their functions etc in ui.ts (or code.ts) files. I have tried ProvidePlugin but it didnt work for me.
  • with current webpack configuration, all the final files get dumped into output folder (dist folder for now) and are at the same level. However, i would like to refactor the code better and want a certain kind of package structure. I am not sure if its possible.

Please suggest.
Sandeep Pr