@polylith/builder 0.2.21 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/App.js +9 -5
  2. package/package.json +1 -1
package/App.js CHANGED
@@ -32,7 +32,8 @@ export default class App {
32
32
  * Construct the app object.
33
33
  *
34
34
  * @param {String} name a name for the app
35
- * @param {Object} config
35
+ * @param {Object} config polylith configuration file
36
+ * @param {Object} setup
36
37
  * @property {String} root the full path to the root directory of the project.
37
38
  * All other paths will be relative to this path.
38
39
  * @proprty {String} index the relative path to the main source file from the
@@ -45,9 +46,11 @@ export default class App {
45
46
  * @property {String} testDest the relative path to the testing destination
46
47
  * folder from the root for rolled up files
47
48
  */
48
- constructor(name, config) {
49
- var {root, index, dest, spec, testDest=''} = config;
49
+ constructor(name, config, setup) {
50
+ var {root, index, dest, spec, testDest=''} = setup;
50
51
 
52
+ this.polylithConfig = config;
53
+ this.setup = setup;
51
54
  root = forceToPosix(root);
52
55
  this.root = root;
53
56
  this.routerRoot = '/' + name;
@@ -698,6 +701,7 @@ export default class App {
698
701
  var manualChunks = this.getManualChunks();
699
702
  var mainCss = await this.buildMainCss();
700
703
  var codeVariables = this.getCodeVariablesValue();
704
+ var sourceMap = !this.polylithConfig.minify;
701
705
 
702
706
  this.templateVariables['mainCss'] = mainCss;
703
707
  this.templateVariables['codeVariables'] = codeVariables;
@@ -734,7 +738,7 @@ export default class App {
734
738
  watchLog(),
735
739
  ];
736
740
 
737
- if (env !== 'dev') plugins.push(terser());
741
+ if (this.polylithConfig.minify) plugins.push(terser());
738
742
 
739
743
  if (this.liveReload) {
740
744
  let plugin;
@@ -763,7 +767,7 @@ export default class App {
763
767
  },
764
768
  output : {
765
769
  output : {
766
- sourcemap: true,
770
+ sourcemap: sourceMap,
767
771
  dir : this.destPath,
768
772
  format: 'es',
769
773
  assetFileNames: function(chunkInfo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polylith/builder",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "The polylith builder",
5
5
  "main": "index.js",
6
6
  "type": "module",