buildStatic and conditional boolean true with rollup enabled in jspm@beta #831
Description
Hello,
when I try to compile with conditional boolean in true and rollup enabled I am getting follow error:
Error: TypeError: Error compiling esm module "@dummy-entry-point" at null
Path must be a string. Received null
at builder.buildStatic.then.catch (/Users/horasikus/work_latest/conditional/gulpfile.js:19:35)
at tryCatcher (/Users/horasikus/work_latest/conditional/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/horasikus/work_latest/conditional/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise
...
I already checked similar issues 339 and 549 but it seems a new issue because now ENV is well resolved only throwing this exception when the condition is true.
If i disable rollup the bundle is ok.
src/env.conditions.js (it is not used by the builder static, only for dev mode)
export var mock = true;
jspm.config.js
SystemJS.config({
map: {
"ENV": "src/env.conditions.js"
},
nodeConfig: {
"paths": {
"npm:": "jspm_packages/npm/"
}
},
devConfig: {
"map": {
"plugin-babel": "npm:[email protected]"
}
},
packages: {
"src": {
"format": "esm",
"meta": {
"*.js": {
"loader": "plugin-babel"
}
}
}
}
});
src/app.js
import './employee.mock.js#?ENV|mock';
src/employee.mock.js
export default name = 'foo';
gulpfile.js
gulp.task('bundle', (cb) => {
const Builder = require('systemjs-builder');
const builder = new Builder();
const inputPath = 'src/app.js';
const outputFile = `dist/app.js`;
const outputOptions = {
conditions: {
'ENV|mock.js': true
},
rollup: true
};
builder.loadConfig('jspm.config.js')
.then(() => {
builder.buildStatic(inputPath, outputFile, outputOptions)
.then(() => cb())
.catch((ex) => cb(new Error(ex)));
});
});
package.json
{
"name": "conditional",
"version": "0.0.0",
"description": "",
"jspm": {
"devDependencies": {
"plugin-babel": "npm:systemjs-plugin-babel@^0.0.25"
}
},
"dependencies": {
"systemjs-builder": "^0.16.9"
}
}
I tried command line with the same results. I'm using latest jspm 0.17.0-beta.42.
This issue only happens building the static bundle; jspm+systemjs in dev mode (load modules as separate files with ES6 in the browser) work as expected (playing with the condition in src/env.conditions.js). Also only fails with output format is esm.