<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>178216</bug_id>
          
          <creation_ts>2017-10-12 10:09:59 -0700</creation_ts>
          <short_desc>ES6 Modules: Syntax, binding errors don&apos;t provide source file or line number</short_desc>
          <delta_ts>2017-10-12 19:15:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Connamacher">richardconnamacher</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1359619</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Connamacher">richardconnamacher</who>
    <bug_when>2017-10-12 10:09:59 -0700</bug_when>
    <thetext>When an ES6 module (loaded via an import statement) contains a syntax error or error in resolving an &quot;import&quot; statement, the error message printed to the Console is unhelpful.

Specifically, it doesn&apos;t say which file or line number had the error, and the stack trace simply lists the native &quot;promiseReactionJob&quot;.

// main.js:

    import {foo} from &quot;./foo.js&quot;

// foo.js:

    syntax error!
    export const foo = &quot;Foo&quot;;

// Console message:

    SyntaxError: Unexpected identifier &apos;error&apos;
      promiseReactionJob

In a traditional script, the syntax error would also indicate the source file (foo.js) and line number (1).

This also happens when an &quot;import&quot; is invalid, such as a missing binding:

// main.js:

    import {bar} from &quot;./foo.js&quot;

// foo.js:

    export const foo = &quot;Foo&quot;;

// Console message:

    SyntaxError: Importing binding name &apos;bar&apos; is not found.
      link
      linkAndEvaluateModule
      (anonymous function)
      promiseReactionJob

As well as if the URL can&apos;t be loaded:

// main.js

    import {foo} from &quot;./missing.js&quot;;

// Console message:

    Failed to load resource: the requested URL was not found on the server     &lt;url&gt;/missing.js

(Would help if it also said which source file had the failed import statement.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1359891</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-10-12 19:13:51 -0700</bug_when>
    <thetext>&lt;rdar://problem/34969296&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>