Skip to content

jacekkarczmarczyk/importmap-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

importmap-plugin

Vite/Rollup import maps plugin

Usage

// vite.config.ts
import ImportmapPlugin from 'importmap-plugin';

export default defineConfig({
  build: {
    rollupOptions: {
      output: {
        format: 'system', // 'system' or 'es'
        entryFileNames: 'app/index.js', // DO NOT INCLUDE HASH HERE
        chunkFileNames: 'chunks/[name].js', // DO NOT INCLUDE HASH HERE
        plugins: [
          ImportmapPlugin({
            base: '/', // same as `base` option in Vite config
            external: true, // external import maps work only for SystemJS
            indexHtml: 'index.html', // entry html file name
            hashLength: 8,
          }),
        ],
      },
    },
  },
});

Disclaimer

This is just a proof of concept. Use at your own risk.