Search code examples
javascriptwebsingle-page-applicationbrowserifystatic-site

Browserify: App Logic in Bundled Source or Separate?


Getting started with a SPA static site web app project centered around a library only available on NPM. I'm looking into using Browserify in my build process for the first time. Should I build out my web app logic in the precompiled source with the require statements, then compile and have one file, or should I expose functions through window.functionName and have my app logic be separate?

Thanks!


Solution

  • You should build out your app logic in a precompiled source with import statements. What benefit do you get from exposing functions on the window object? It's usually not recommended.