I have a problem when use systemjs-builder to build my app.
This is structure of my app.

And this is function to build:
var systemjsBuild = {
map: {
'angular2': '../node_modules/angular2',
'rxjs': '../node_modules/rxjs'
},
packages: {
dist: {
format: 'register',
defaultExtension: 'js'
}
}
};
function buildSJS () {
var builder = new Builder('dist');
builder.config(systemjsBuild);
builder.loader.defaultJSExtensions = true;
builder
.bundle('main', 'build/main.js',
{
minify: true,
globalDefs: { DEBUG: false }
})
.then(function () {
console.log('Build complete');
done();
})
.catch(function (ex) {
console.log('error', ex);
done('Build failed.');
});
}
But It can not work,
error [Error: Unable to calculate canonical name to bundle file:///E:/myapp/node_modules/angular2/core.js
And if I run serve-dev with root is dist, angular2/core.js load content is content of index.html file.
index.html
<body>
<script src="assets/bundle.js"></script>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
},
map: {
'angular2': '../node_modules/angular2'
}
});
System.import('main.js')
.then(null, console.error.bind(console));
</script>
</body>
Please help me, thanks
I think you should be setting the baseURL to below the module path so the baseURL to a folder that includes the build folder within it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With