Would it work to run a bundler over your code, so all (static) imports are inlined and tree shaken?