https://github.com/2fd/system-smart
Smart bundle for systemjs
https://github.com/2fd/system-smart
Last synced: 8 months ago
JSON representation
Smart bundle for systemjs
- Host: GitHub
- URL: https://github.com/2fd/system-smart
- Owner: 2fd
- License: mit
- Created: 2017-03-08T02:38:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-08T07:03:00.000Z (over 9 years ago)
- Last Synced: 2025-03-13T07:13:44.238Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# system-smart
[](https://travis-ci.org/2fd/system-smart)
Smart bundle genrator for [systemjs/builder](https://github.com/systemjs/builder)
## Use
Generate smart bundles
```javascript
var Builder = require('systemjs-builder');
require('system-smart');
var builder = new Builder(/* ... */);
builder
.smart(['entrypoint-a.js', 'entrypoint-b.js' /* , 'other entrypoints'*/], './dist')
.then(result => {
// result =
[
{ // entrypoint-a.js
hash: '[SHA1]', // content hash
name: '[SHA1].bundle.js', // output filename
path: '/path/to/dist/[SHA1].bundle.js', // output dest
source: '...',
sourceMap: '...',
modules: [ 'entrypoint-a.js', /* depencies */ ]
},
{ // entrypoint-b.js
hash: '[SHA1]', // content hash
name: '[SHA1].bundle.js', // output filename
path: '/path/to/dist/[SHA1].bundle.js', // output dest
source: '...',
sourceMap: '...',
modules: [ 'entrypoint-b.js', /* depencies */ ]
},
{ // Smart bundles
hash: '[SHA1]', // content hash
name: '[SHA1].bundle.js', // output filename
path: '/path/to/dist/[SHA1].bundle.js', // output dest
source: '...',
sourceMap: '...',
modules: [ /* commond depencies */ ]
},
// More smart bundles
]
})
```
Add bundles to systemjs configuration
```javascript
javascript
SystemJS.config({
bundles: {
'dist/[SHA1].bundle.js': [ 'entrypoint-a.js', /* depencies */ ],
'dist/[SHA1].bundle.js': [ 'entrypoint-b.js', /* depencies */ ],
'dist/[SHA1].bundle.js': [ /* commond depencies */ ],
// [outputDir + result.name]: result.modules
}
});
```