-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Duplicate emit when using amd-dependency and es6 ambient import #5021
Comments
this looks right to me. you have two imports one to import "/jquery/jquery.min.js"; |
Thanks for the reply, Mohamed. I wrote a response before, but I deleted it because I think this one is better. I wasn't aware of the minimalist import syntax that you suggested, and it does work in this case. However, I think maybe jQuery was a bad example because it's actually implemented as a UMD module so Perhaps I'm just hitting up against #2338 again. This new example may better-illustrate what I was expecting. Let's say I want to rename ///<amd-dependency name="jq" path="/jquery/jquery.min.js" />
import * as jq from 'jquery';
jq('#myDiv').html('Hello'); I was expecting this emit:
But I got this emit:
Notice - two Am I just stuck until the mapping functionality is added to tsconfig.json as part of AMD support in #2338? Thank you so much, as always!!! |
What you describe was never the intended behavior of the 'amd-dependency' tags, these were mainly kept for importing non-code resources, and should not be used with imports. |
OK. Thanks for your responses. It's been very helpful. As far as aliasing dependencies as a Thanks. Edit: others are asking too: #2338 (comment) @mpawelski |
Hi,
I think that the
///<amd-dependency />
functionality exhibits odd behavior when combined with an ES6 import.For example, this TypeScript code:
emits as this JS when using AMD module mode:
In the emitted JS, the string 'jquery' is included in the requirements for the module (causing an HTTP 404 error at runtime). My expectation would be that 'jquery' here would be considered the same as the 'jquery' inside the amd-dependency comment, so it would be de-duplicated and that only "/jquery/jquery.min.js" would be passed along to the emitted JS.
I can simply remove the ES6-style import and the emit works as expected.
Am I crazy on this?
I know this will probably be moot once #2338 hits.
Possibly related: #4004.
The text was updated successfully, but these errors were encountered: