神刀安全网

cbuild: Use SystemJS with npm instead of jspm

cbuild

cbuild: Use SystemJS with npm instead of jspm cbuild: Use SystemJS with npm instead of jspm cbuild: Use SystemJS with npm instead of jspm

cbuild is a command line interface for systemjs-builder with Node.js module resolution to find packages installed using npm without additional configuration. This allows publishing leaner packages running without build tools. npm itself can pull all required frontend and backend dependencies.

cbuild supports the browser field in package.json . It can also generate a minimal config.js for SystemJS to load packages without having to bundle them. npm@3 or the dedupe command in npm@2 natively handles package deduplication. For more complicated scenarios, the full power of SystemJS is still available for loading and bundling.

Usage

Make sure your package.json has a browser and/or main field and add in the scripts section:

"scripts": {     "cbuild": "cbuild"   }

Then run the commands:

npm install --save-dev cbuild npm run cbuild -- bundle.js

This generates a new file bundle.js with all code required to load the file defined in the browser (or main if browser is missing) field of package.json .

Run npm run cbuild -- --help to see the command line options:

  Usage: cbuild [options] <output-bundle-path>    SystemJS node module bundling tool    Options:      -h, --help               output usage information     -V, --version            output the version number     -p, --package <path>     Path to directory with package.json and config.js     -C, --out-config <path>  Path to new config.js to overwrite with path mappings 

API

Docs generated using docts

Interface BuildOptions

Source code: <>

Properties:

.sourcePath ? string

.outConfigPath ? string

Function build

Bundle file in sourcePath inside package in basePath,

writing all required code to file in targetPath.

Source code: <>

build( )

Bluebird<void>

<>

▪ basePath string

▪ targetPath string

▫ options ?

BuildOptions

License

The MIT License

Copyright (c) 2016 BusFaster Ltd

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » cbuild: Use SystemJS with npm instead of jspm

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮