Skip to content

Update to use new manifest format in Vite 2.0.0-beta.51#8

Merged
ElMassimo merged 12 commits into
mainfrom
support-51
Jan 29, 2021
Merged

Update to use new manifest format in Vite 2.0.0-beta.51#8
ElMassimo merged 12 commits into
mainfrom
support-51

Conversation

@ElMassimo
Copy link
Copy Markdown
Owner

@ElMassimo ElMassimo commented Jan 29, 2021

Description 📖

This pull request adds support for Vite 2.0.0-beta.51 and higher (tested on 56).

It adds a new plugin to generate a manifest-assets.json file in the output for any CSS or asset entrypoints.

No changes to the public-facing API of this library 😎

Background 📜

There are breaking changes to the manifest format in beta.51 and beta.53, that required updating the way the manifest is parsed.

Those changes also required adding a plugin to generate a separate manifest for assets, since Vite's manifest now assumes all entries are JS or HTML.

Screenshots 📷

Screen Shot 2021-01-29 at 12 31 55

def resolve_references(manifest)
manifest.each_value do |entry|
entry['file'] = prefix_vite_asset(entry['file'])
entry['css'] = Array.wrap(entry['css']).map { |path| prefix_vite_asset(path) } if entry['css']
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Wrapping the array ensures compatibility with beta 51.

when :javascript then 'js'
when :stylesheet then 'css'
when :typescript then dev_server_running? ? 'ts' : 'js'
when :typescript then 'ts'
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Vite now uses the actual file extension in the manifest, so we can simplify here.

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.

1 participant