Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
format flexibility and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jun 23, 2015
1 parent 988aeb6 commit ad668f7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function compileOutputs(loader, tree, opts, sfxEntryPoints, cache) {
}

exports.wrapSFXOutputs = wrapSFXOutputs;
var formats = ['amd', 'cjs', 'esm', 'global'];
function wrapSFXOutputs(loader, tree, outputs, sfxEntryPoints, opts) {
var compilers = {};

Expand All @@ -148,8 +149,16 @@ function wrapSFXOutputs(loader, tree, outputs, sfxEntryPoints, opts) {
// determine compilers used
modules.forEach(function(name) {
var load = tree[name];
if (load.metadata.build !== false)
if (load.metadata.build !== false) {
var format = load.metadata.format;
// NB to be deprecated with SystemJS 0.19
if (format == 'es6')
format = 'esm';
if (!(load.metadata.format in compilerMap))
throw new Error(name + ' has format set to "' + load.metadata.format + '", which is not valid. Must be one of "esm", "amd", "cjs", "global" or "register".');

compilers[load.metadata.format] = true;
}
});

// include compiler helpers at the beginning of outputs
Expand Down

0 comments on commit ad668f7

Please sign in to comment.