Skip to content

Modify Asset with a Runtime #4656

Answered by mischnic
101arrowz asked this question in General
May 24, 2020 · 1 comments · 11 replies
Discussion options

You must be logged in to vote

Runtimes can add additional assets, so you can add a javascript asset that runs before a bundle's actual entrypoint is run:

return {
filePath: __filename,
code: CODE,
isEntry: true,
};

In the case of HTML, the whole file is one asset (since 1 HTML source file becomes 1 HTML bundle), and multiple HTML assets in the same bundle don't have a defined order. (Note that this is a rather arbitrary implementation decision in @parcel/packager-html, you could write your own packager.)

WIP (plugin) docs: https://parcel2-docs.now.sh/plugin-system/

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@mischnic
Comment options

@101arrowz
Comment options

101arrowz May 27, 2020
Collaborator Author

@101arrowz
Comment options

101arrowz May 27, 2020
Collaborator Author

@mischnic
Comment options

@101arrowz
Comment options

101arrowz May 27, 2020
Collaborator Author

Answer selected by 101arrowz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants