I've recently taken the step to refactor all the ever-growing JS code of one of my projects into module logic for better organization. Although working fine so far, one of the caveats I ran into is that several of my scripts are integrated into an userscript which I'm running via ViolentMonkey. @require
-ing a script that used any module logic would simply prevent the userscript from running at all.
What can I do to make my userscript run with module logic? I heard people recommending require.js
, but I've also seen opinions about AMD not being that great and I don't find the proposed coding style to be very appealing either. Would it still be possible to make it work with javascript native module logic? It's hard for me to make my opinion on this, so any input would be welcome.
I'm running the userscript on firefox exclusively and content-injected. I'm not running any package manager or transpiler, and I would like to keep it that way if possible.