Skip to content
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

Polymer breaks dependency resolution with query strings #513

Closed
keithamus opened this issue May 22, 2014 · 3 comments
Closed

Polymer breaks dependency resolution with query strings #513

keithamus opened this issue May 22, 2014 · 3 comments

Comments

@keithamus
Copy link

As far as I've read in the docs, Polymer allows you to specify a dependency multiple times, and it will just sort it out - so your index.html could have the following:

    <head>
        <script src="main/bower_components/platform/platform.js"></script>
        <link rel="import" href="main/components/a/a.html">
        <link rel="import" href="main/components/b/b.html">
    </head>

Where a is

<link rel="import" href="../../bower_components/polymer/polymer.html">
<polymer-element name="a-element">
    <template>
        <div></div>
    </template>
    <script type="text/javascript">
        Polymer('a-element', {});
    </script>
</polymer-element>

and b is

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../a/a.html">

<polymer-element name="b-element">
    <template>
        <a-element>
            <div></div>
        </a-element>
    </template>
</polymer-element>

This all works great. However, add query string parameters to the elements, and everything breaks:

    <head>
        <script src="main/bower_components/platform/platform.js"></script>
        <link rel="import" href="main/components/a/a.html?break">
        <link rel="import" href="main/components/b/b.html?break">
    </head>

Now with the additional query string you get the following breakage:

[Error] Error: DuplicateDefinitionError: a type with name 'a-element' is already registered (platform.js, line 15)
@sjmiles
Copy link
Contributor

sjmiles commented May 22, 2014

main/components/a/a.html?break and main/components/a/a.html are different URLs that could produce completely different resources from the server. One can imagine components/mine?x-foo and components/main?x-bar that produce separate elements.

@robdodson
Copy link
Contributor

Related thread on polymer-dev

I wonder if it's possible to opt-out of this feature in Karma?

@morethanreal
Copy link
Contributor

For the karma issue, perhaps a workaround is to use {included: false} in the config? e.g. in karma.conf.js:

files: [
  'a.html',
  {pattern: 'b.html', included: false}
]

That tells karma that b.html should be served, but do not include it in context.html or debug.html.

In general, b.html and b.html?something are considered completely different resources. In karma's case, it seems like maybe cache busting should be disabled for HTML Imports. Filed karma-runner/karma#1073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants