systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
83 stars 33 forks source link

Unexpected token { #63

Closed JeffBaumgardt closed 7 years ago

JeffBaumgardt commented 7 years ago

Hi guys I've been running into this occasionally since setting my transpiler to babel. If I refresh it goes away and it's different files most of the time. I can go hours without seeing it or see it twice in two reloads. I'm not sure what the issue is.

system.src.js:122 Uncaught (in promise) Error: (SystemJS) https://localhost.catalystapps.com:8080/ui/app/pages/site/detail/macros/macros.js: Unexpected token (20:48)
      18 |  prevVals: null,
      19 | 
    > 20 |  init: function(applyValues, saveDoc, onChange) {
         |                                                 ^
      21 |      mod.applyValues = applyValues
      22 |      mod.saveDoc = saveDoc
      23 |      mod.onChange = onChange
'*.js': {
    'loader': 'plugin-babel',
    'format': 'cjs',
    'babelOptions': {
        'modularRuntime': false
    }
}
guybedford commented 7 years ago

Which version of plugin-babel are you using here? Have you tried updating to the latest?

JeffBaumgardt commented 7 years ago

I have systemjs-plugin-babel@0.0.14

JeffBaumgardt commented 7 years ago

I will try updating now

JeffBaumgardt commented 7 years ago

I upgraded to 0.0.15 and just ran into the same issue. Again it's intermittent and very hard to reproduce. I wish I had better steps.

JeffBaumgardt commented 7 years ago

Here's a full stack

1474320648319
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Error: (SystemJS) https://localhost.catalystapps.com:8080/ui/app/pages/site/detail/viewers/viewers.js: Unexpected token (15:20)
      13 | 
      14 |  kImporters: {
    > 15 |       xhtml: function() {
         |                        ^
      16 |          return SystemJS.import('./preview/preview.js', module.id)
      17 |      },
      18 |      pdfviewer: function() {
    SyntaxError: https://localhost.catalystapps.com:8080/ui/app/pages/site/detail/viewers/viewers.js: Unexpected token (15:20)
      13 | 
      14 |  kImporters: {
    > 15 |       xhtml: function() {
         |                        ^
      16 |          return SystemJS.import('./preview/preview.js', module.id)
      17 |      },
      18 |      pdfviewer: function() {
        at c.h.raise (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:18733)
        at c.i.unexpected (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:14:7064)
        at c.i.expect (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:14:6938)
        at c.m.parseBlock (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:14:16021)
        at c.m.parseFunctionBody (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:15079)
        at c.m.parseFunction (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:14:18390)
        at c.m.parseFunctionExpression (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:8353)
        at c.m.parseExprAtom (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:7613)
        at c.m.parseExprSubscripts (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:3126)
        at c.m.parseMaybeUnary (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:2744)
        at c.m.parseExprOps (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:1321)
        at c.m.parseMaybeConditional (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:902)
        at c.m.parseMaybeAssign (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:186)
        at c.m.parseObjPropValue (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:12928)
        at c.m.parseObj (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:12348)
        at c.m.parseExprAtom (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:7563)
        at c.m.parseExprSubscripts (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:3126)
        at c.m.parseMaybeUnary (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:2744)
        at c.m.parseExprOps (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:1321)
        at c.m.parseMaybeConditional (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:902)
        at c.m.parseMaybeAssign (https://localhost.catalystapps.com:8080/ui/jspm_packages/npm/systemjs-plugin-babel@0.0.15/systemjs-babel-browser.js:15:186)
    Error loading https://localhost.catalystapps.com:8080/ui/app/pages/site/detail/viewers/viewers.js as "./viewers/viewers.js" from https://localhost.catalystapps.com:8080/ui/app/pages/site/detail/doc.js
spiritson commented 7 years ago

+1. Happens on Google Chrome(Chrome/53.0.2785.116) , but never saw it on Safari/Firefox

guybedford commented 7 years ago

If anyone can share a replication here that would be a great start.

spiritson commented 7 years ago

It very hard to reproduce definitively, but I believe it only happens on the Chrome version mentioned above. I checked in Canary and I am yet to see the error. I believe its a Chrome issue.

JeffBaumgardt commented 7 years ago

I wish I had more to go off of. Since it's random files and only happens sporadically there is nothing that points to a single specific issue here. Perhaps it is chrome as @spiritson suggests. I wish I had more by guys are getting fairly annoyed with this error and I wish I had more to tell them.

JeffBaumgardt commented 7 years ago

Without uncrossing my fingers Chrome 54 has yet to cause this error. I'm unsure what would be in the engine that would cause this.

spiritson commented 7 years ago

@Medros , Good that you are not seeing this error in 54. Hopefully the issue is dead. Technically no explanation though