简体   繁体   中英

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.

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

PS 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM