Skip to content

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Mar 10, 2024

For JavaScript scripts (see script[type]), the src attribute is resolved as an import; for non-JavaScript scripts, it is resolved as a file. This means you can now load vanilla JavaScript scripts (or modules), and it “just works”. For module scripts, the module is also preloaded.

@mbostock mbostock requested a review from Fil March 10, 2024 23:49
@mbostock

This comment was marked as resolved.

@mbostock mbostock marked this pull request as draft March 11, 2024 00:55
@Fil

This comment was marked as resolved.

@mbostock mbostock force-pushed the mbostock/script-src branch from 284d8a3 to 5cd7fac Compare March 15, 2024 03:22
@mbostock mbostock marked this pull request as ready for review March 15, 2024 03:22
@mbostock
Copy link
Member Author

Okay, this is ready! I was motivated after another support request #1061 came up.

@mbostock mbostock changed the title include script[src] in assets resolve script[src] Mar 15, 2024
@mbostock mbostock enabled auto-merge (squash) March 15, 2024 06:32
Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Do you think it would be possible to alias the script (from foo.js?sha=1234 to foo.1234.js) in both cases? Or is there something that makes it impossible in principle?

@mbostock mbostock merged commit 4c0582e into main Mar 15, 2024
@mbostock mbostock deleted the mbostock/script-src branch March 15, 2024 07:38
@mbostock
Copy link
Member Author

Do you think it would be possible to alias the script (from foo.js?sha=1234 to foo.1234.js) in both cases?

Oops, that’s a bug. If we don’t fix this the built site is broken!

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 this pull request may close these issues.

2 participants