Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26611] Babel minify can error and prevent application from building

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2018-11-29T00:38:52.000+0000
Affected Version/sRelease 8.0.0
Fix Version/sRelease 8.0.0
Componentsn/a
Labelsn/a
ReporterGary Mathews
AssigneeGary Mathews
Created2018-11-29T00:22:23.000+0000
Updated2018-11-29T00:38:52.000+0000

Description

I encountered an interesting error when attempting to build a test case:
const win = Ti.UI.createWindow({ backgroundColor: 'gray', layout: 'vertical' });
const btn_js = Ti.UI.createButton({ title: 'JAVASCRIPT' });
const btn_native = Ti.UI.createButton({ title: 'NATIVE' });

btn_js.addEventListener('click', (e) => {
    const object = {};
    console.log(object.test.crash);
});

btn_native.addEventListener('click', (e) => {
    Ti.Geolocation.accuracy = {};
});

win.add([ Ti.UI.createView({ height: 80 }), btn_js, btn_native ]);
win.open();

/*var worker = require('ti.worker');

var window = Ti.UI.createWindow({
  backgroundColor: 'white',
});

var view = Ti.UI.createView({
  backgroundColor: 'white',
  top: 20
});

var label1 = Ti.UI.createLabel({
  text: 'Calculating prime',
  width: Ti.UI.FILL,
  height: Ti.UI.FIT,
  textAlign: 'center',
  color: 'red',
  top: 10
});

var label2 = Ti.UI.createLabel({
  text: 'Calculating prime',
  width: Ti.UI.FILL,
  height: Ti.UI.FIT,
  textAlign: 'center',
  color: 'green',
  top: 40
});

var label3 = Ti.UI.createLabel({
  text: 'Calculating prime',
  width: Ti.UI.FILL,
  height: Ti.UI.FIT,
  textAlign: 'center',
  color: 'blue',
  top: 70
});

var button = Ti.UI.createButton({
  title: 'Terminate',
  width: Ti.UI.FIT,
  height: Ti.UI.FIT,
  top: 100
});

window.add(view);
view.add(label1);
view.add(label2);
view.add(label3);
view.add(button);
window.open();

var thread1 = worker.createWorker('prime.js');

thread1.addEventListener('message', function(event) {
  label1.text = event.data;
});

/*
var thread2 = worker.createWorker('prime.js');

thread2.addEventListener('message', function(event) {
  label2.text = event.data;
});

var thread3 = worker.createWorker('prime.js');

thread3.addEventListener('message', function(event) {
  label3.text = event.data;
});

thread1.addEventListener('terminated', function() {
  label1.text = 'Terminated';
});

thread2.addEventListener('terminated', function() {
  label2.text = 'Terminated';
});

thread3.addEventListener('terminated', function() {
  label3.text = 'Terminated';
});

button.addEventListener('click', function() {
  thread1.terminate();
  thread2.terminate();
  thread3.terminate();
});
*/
[INFO]  Processing JavaScript files
[ERROR] Cannot read property 'isPure' of null
What's interesting is this only occurs when building to a device...
appc run -p android -T device
And resolves itself when I comment out the opts.minify condition block in jsanalyze.js

Comments

  1. Gary Mathews 2018-11-29

    Turns out this issue has been resolved by updating babel-minify and node-titanium-sdk has already been updated to resolve this issue. https://github.com/appcelerator/titanium_mobile/commit/847fbdfb3bc723e7b535addbd1eea344bfdf1f61

JSON Source