0.1.0 • Published 1 year ago

@sables/vite-plugin-import-tags v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@sables/vite-plugin-import-tags

Tags dynamic imports for server-side rendered module preload links.

Tags dynamic imports, and generates a manifest mapping them to source files. The manifest can then be used for preloading chunks for server-side rendering. This functionality is similar to the Loadable Components Babel Plugin.

The tag used on the dynamic imports is a call to a noop function. A noop function is used to prevent optimizers from removing the tag, as is often the case with comments and string directives.

This plugin is used by the Sables CLI during its build command. Please view the CLI documentation for more information.

Todo

  • Update pattern to not tag imports in comments.
    • It doesn't break anything, and comments are typically removed from bundles anyway, so this is very low priority.