New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-bundler produces code error #1021

Closed
darylcober opened this Issue Jan 21, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@darylcober
Copy link

darylcober commented Jan 21, 2019

I'm submitting a bug report

  • Library Version:
    1.0.0-beta.7

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    10.14.0

  • NPM Version:
    6.4.1
  • Browser:
    Chrome 71.0.3578.98

  • Language:
    ESNext

  • Loader/bundler:
    RequireJS

Current behavior:
Some npm packages are missing trailing semicolon in code.
When offending package is included in project following error is reported in console:
Uncaught TypeError: (intermediate value)(intermediate value)(...) is not a function
at vendor-bundle.js:29062

Following snip-it is from vendor-bundle.js :
........................................
})(this)

/* Hammer-time - v0.3.0

  • http://github.com/hammerjs/hammer-time
  • Copyright Alexander Schmitz and other contributors
  • Released under the MIT license
  • Expiramental fastclick based on a partial polyfill of
  • touch-action: none; CSS property
    */

( function() {
........................................

Error => Missing ';' at end of blueimp-mdr js file. The following package starts with a js closure. There must be a semicolon seperating code packages.

Note: The Blueimp-md5 minified package contains the trailing ; therefore no error is raised.

  • What is the expected behavior?

Can be reproduced by adding the following packages:
npm install blueimp-md5 --save
npm install hammer-timejs --save

import packages into app.js so they are included in bundle.
import md5 from "blueimp-md5";
import hammer from "hammer-timejs";

Note: this is more of a feature request rather than an actual bug in the bundler.

  • What is the motivation / use case for changing the behavior?

The only current way to resolve this error is to edit the included file in the bundle to manually insert the missing semicolon.

It would be desirable to have the bundler check each package for a trailing semicolon and insert if missing.

huochunpeng added a commit to huochunpeng/cli that referenced this issue Jan 21, 2019

fix(bundler): tolerant js with missing ending semicolon
Some js lib (like blueimp-md5) doesn't have a ending semicolon. Existing bundler results in syntax error.

closes aurelia#1021

huochunpeng added a commit to huochunpeng/cli that referenced this issue Jan 21, 2019

fix(bundler): tolerant js with missing ending semicolon
Some js lib (like blueimp-md5) doesn't have an ending semicolon. Existing bundler results in syntax error.

closes aurelia#1021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment