Skip to content

Commit

Permalink
Use minify prelude only minify option (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
S. Suzuki authored and DeMoorJasper committed Jul 11, 2018
1 parent 764f568 commit b52548b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/packagers/JSConcatPackager.js
Expand Up @@ -7,10 +7,16 @@ const walk = require('babylon-walk');
const babylon = require('babylon');
const t = require('babel-types');

const prelude = fs
.readFileSync(path.join(__dirname, '../builtins/prelude2.min.js'), 'utf8')
.trim()
.replace(/;$/, '');
const prelude = {
source: fs
.readFileSync(path.join(__dirname, '../builtins/prelude2.js'), 'utf8')
.trim(),
minified: fs
.readFileSync(path.join(__dirname, '../builtins/prelude2.min.js'), 'utf8')
.trim()
.replace(/;$/, '')
};

const helpers =
fs
.readFileSync(path.join(__dirname, '../builtins/helpers.js'), 'utf8')
Expand Down Expand Up @@ -514,8 +520,9 @@ class JSConcatPackager extends Packager {
output = '\n' + output + '\n';
}

let preludeCode = this.options.minify ? prelude.minified : prelude.source;
if (this.needsPrelude) {
output = prelude + '(function (require) {' + output + '});';
output = preludeCode + '(function (require) {' + output + '});';
} else {
output = '(function () {' + output + '})();';
}
Expand Down

0 comments on commit b52548b

Please sign in to comment.