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

When loading via AMD loader, module execution order can be unexpected #335

Closed
sorvell opened this issue May 5, 2018 · 1 comment · Fixed by #339
Closed

When loading via AMD loader, module execution order can be unexpected #335

sorvell opened this issue May 5, 2018 · 1 comment · Fixed by #339

Comments

@sorvell
Copy link
Contributor

sorvell commented May 5, 2018

This causes flakiness in ShadyCSS style processing because that library has load order requirements that users must adhere to.

  1. a test loads polymer-legacy.js
  2. polymer-legacy loads

Based on this, I expect apply-shim to load and execute before custom-style.

However, it does not (verified via logging and Edge element inspector):

screen shot 2018-05-04 at 7 33 29 pm

@rictic
Copy link
Contributor

rictic commented May 5, 2018

I think what's happening is that we're not following the full es6 import ordering semantics. If you've got:

start.js

import 'foo';
import 'baz';

foo.js

import 'bar';

Then the execution order is defined as: bar, foo, baz, start, but I think our loader is racy and might run baz first.

So to do this right we can't just run module bodies when all of their imports are present, we also need to obey ordering of their parents' dependencies, which can be extra tricky when cycles get involved.

I'll put together some tests to verify that this is what's happening.

rictic added a commit that referenced this issue May 5, 2018
rictic added a commit that referenced this issue May 5, 2018
justinfagnani pushed a commit that referenced this issue Jul 10, 2018
Fixes #334

Also:

- Added `--flat` and `--private` CLI flags, both of which default to `false`. Previously we set `flat` to `true` by default, and did not touch `private`.
- Map Bower `main` foo.html to NPM `main` foo.js. Previously we just copied  it.
- Check for multiple licenses (valid for Bower, not for NPM) and warn.
- Add typings for NPM and Bower configs.
- Map Bower `authors` to NPM `author`/`contributors`. Previously we directly copied `authors`, which doesn't exist in Bower (although we use it in at least one element, so I kept it as a fallback).
- Improve warning messages.
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

Successfully merging a pull request may close this issue.

2 participants