Skip to content

[bundler] Fixed the problem where we totally failed at inlining external module script tags.#334

Merged
usergenic merged 5 commits intomasterfrom
es6-module-inlining-fail
May 7, 2018
Merged

[bundler] Fixed the problem where we totally failed at inlining external module script tags.#334
usergenic merged 5 commits intomasterfrom
es6-module-inlining-fail

Conversation

@usergenic
Copy link
Copy Markdown
Contributor

Fixes #332 which was due to a misunderstanding of what _inlineModuleScripts was doing (it wasn't inlining module scripts, it was rolling up scripts that were already inline) and so external script type module tags were being ruined by having their attributes set to relative path to the bundle, which is an empty string.

This is fixed.

Inlining strategy is basically creating a script tag with a single import statement to the thing to import and letting existing rollup code take care of the rest.

@usergenic
Copy link
Copy Markdown
Contributor Author

@rictic I added a build to the polymer.json for the modules fixture which demonstrates the particular case addressed by this PR's updates to the html-bundler.ts - I may add more module bundling cases next week in a different PR.

@usergenic usergenic requested a review from justinfagnani May 7, 2018 18:37
@usergenic usergenic force-pushed the es6-module-inlining-fail branch from 34c39a8 to 3a482dd Compare May 7, 2018 20:33
@usergenic
Copy link
Copy Markdown
Contributor Author

Just rebased on master for clarity.

usergenic added 2 commits May 7, 2018 14:59
…wasn't actually inlining anything when previously that was what its name implied. _inlineModuleScripts -> _rewriteExternalModuleScriptTagsToImports
@usergenic usergenic merged commit 0c75bd3 into master May 7, 2018
@usergenic usergenic deleted the es6-module-inlining-fail branch May 7, 2018 23:09
justinfagnani pushed a commit that referenced this pull request 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bundler] Weird failure to inline of script type=module results in empty inline script with blank src attribute

3 participants