@lightningjs/vite-plugin-import-chunk-url
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

vite-plugin-import-chunk-url

This plugin allows you to declare that a JavaScript/TypeScript file be bundled into a seperate chunk while getting the relative URL to that chunk file. The chunk can then be imported dynamically or run via a worker.

Usage

vite.config.ts

import { importChunkUrl } from 'vite-plugin-import-chunk-url';

export default defineConfig(({ command, mode, ssrBuild }) => {
  return {
    plugins: [
      importChunkUrl(),
    ],
    build: {
      minify: false,
      sourcemap: true,
    }
  };
});

app.ts

import customModuleBundleUrl from './CustomCodeModule.js?importChunkUrl';

import(customModuleBundleUrl).then(/*..*/);

Readme

Keywords

none

Package Sidebar

Install

npm i @lightningjs/vite-plugin-import-chunk-url

Weekly Downloads

91

Version

0.3.1

License

Apache-2.0

Unpacked Size

22.1 kB

Total Files

11

Last publish

Collaborators

  • foxtrotwhiskey9
  • uguraslan
  • michielvandergeest
  • erikhaandrikman
  • wouterlucas
  • jfboeve