Search code examples
jspmsystemjs

SystemJS - Is the jspm_packages folder supposed to be copied to dist and sent to the server?


I'm new to SystemJs and jspm, and I'm working on creating a build process.

Is the jspm_packages supposed to be sent to dist and then the server?

I'm confused about that. My first impression is that it isn't, but after working with SystemJs and jspm for a while I've noticed a couple of things.

  • The sourcemaps point to the jspm_pcakages folder.
  • The paths inside of the CSS files imported with the css-plugin also refer to that folder (think of fonts, images, etc.)

Having those points in mind, I've thought that maybe the idea behind that folder is to be sent to the server after all.


Solution

  • Yes, jspm_packages is supposed to be sent to the server unless you create an sfx- bundle for production. Alternatively, you can point SystemJS to fetch modules from a CDN so that you don't need to host jspm_packages yourself.

    Read more about Production workflows here: https://github.com/jspm/jspm-cli/blob/master/docs/production-workflows.md

    P.S. It's likely that you don't want to have source maps in production. So the only problem is css. You can inject it into the bundle as well: https://github.com/systemjs/plugin-css#builder-support