mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
16 lines
536 B
TypeScript
16 lines
536 B
TypeScript
|
import type { AstroIntegration } from 'astro';
|
||
|
|
||
|
export default function createPlugin(): AstroIntegration {
|
||
|
return {
|
||
|
name: '@astrojs/turbolinks',
|
||
|
hooks: {
|
||
|
'astro:config:setup': ({ injectScript }) => {
|
||
|
// This gets injected into the user's page, so we need to re-export Turbolinks
|
||
|
// from our own package so that package managers like pnpm don't get mad and
|
||
|
// can follow the import correctly.
|
||
|
injectScript('page', `import {Turbolinks} from "@astrojs/turbolinks/client.js"; Turbolinks.start();`);
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
}
|