Importing modules with/without filetype leads to multiple executions
Reported by
johan.is...@gmail.com,
May 4 2017
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3088.3 Safari/537.36 Steps to reproduce the problem: 1. Create a ES6 module 2. Import it in one file as import Module from 'Module.js' 3. Import it in another file as import Module from 'Module' What is the expected behavior? Should only execute once, or at least give a warning What went wrong? Executed twice Did this work before? N/A Chrome version: 60.0.3088.3 Channel: n/a OS Version: OS X 10.12.4 Flash Version: Not sure if it is a bug or by design, but not the way I expect it to work
,
May 5 2017
,
May 9 2017
Could you please provide more information, such as the contents and names of the files involved? I cannot reproduce the problem you're describing. 'Module.js' is not a valid module specifier, you'd have to use './Module.js'. Similarly, 'Module' is not a valid specifier, you'd have to use './Module', but that is distinct from './Module.js'.
,
May 9 2017
I had ./ but forgot it in steps :) Test case attached
,
May 9 2017
Opening the test case prints executed twice to the console, I would only expect once or at least get a warning that the same module has been included with different file endings
,
May 9 2017
Thanks. I still can't reproduce it, for me nothing gets executed because neither "./A" nor "./B" exist. I'm on Linux, though, so maybe on Mac OS X the ".js" suffix magically gets appended?! +hiroshige, +kouhei, who may know more.
,
May 9 2017
Is it possible that your web server is configured such that it tries "A.js" when it can't find "A"? That would explain the behavior. As far as Chrome is concerned, "./Twice" and "./Twice.js" are different.
,
May 9 2017
Apparently Apache on my version of OSX has that behaviour per default. I see TCN and Content-Location headers on those without .js. Don’t know why I didn’t think of that my self… sorry to have bothered you. Thanks for your assistance! On 9 May 2017, 17:43 +0200, n… via monorail <monorail+v2.2428617074@chromium.org>, wrote:
,
May 9 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by tkent@chromium.org
, May 5 2017