Skip to content

Vite plugin that allows you to import the URL of a module that is bundled as a separate chunk.

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
COPYING
Notifications You must be signed in to change notification settings

lightning-js/vite-plugin-import-chunk-url

Repository files navigation

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(/*..*/);

About

Vite plugin that allows you to import the URL of a module that is bundled as a separate chunk.

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
COPYING

Stars

Watchers

Forks

Packages

No packages published