Hi,
I’m facing an issue when building my app for production environment : the JS minification process throws an exception:
Error
at new JS_Parse_Error (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:196:18)
at js_error (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:204:11)
at croak (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:675:9)
at as_symbol (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:1306:27)
at vardefs (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:1081:25)
at var_ (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:1095:27)
at /Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:843:30
at /Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:722:24
at block_ (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:1002:20)
at ctor.body (/Users/benjamin/.meteor/packages/minifier-js/.1.1.11.t8qbi6++os+web.browser+web.cordova/npm/node_modules/uglify-js/lib/parse.js:975:25)
It’s related to the minification of the ES2015 modules, and more precisely the react-tag-input
npm package. The line that makes the minification fail is the one that starts with var { DragDropContext }
:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// node_modules/react-tag-input/dist-modules/reactTags.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
var React = require('react'); // 1
var ReactDOM = require('react-dom'); // 2
var Tag = require('./Tag'); // 3
var Suggestions = require('./Suggestions'); // 4
var { DragDropContext } = require('react-dnd'); // 5
var HTML5Backend = require('react-dnd-html5-backend'); // 6
var merge = require('lodash/object/merge'); // 7
// 8
I’ve struggled to track down the issue: I had to customize the standard-minifiers-js
to catch the error and print the line that fails.
My guess is that var { DragDropContext } = require('react-dnd');
should have been transpiled to es5 but didn’t.
Here are my first 2 packages in .meteor
:
ecmascript
es5-shim
I’m using METEOR@1.3.2.4
and my versions
file says:
babel-compiler@6.6.4
babel-runtime@0.1.8
Why is the transpilation failing?