Skip to content

Provide configuration option to reload only certain urls / pages #20

Description

@acalvino4

Clear and concise description of the problem

My vite config has two inputs sources configured:

input: {
	site: 'src/ts/index.ts',
	admin: 'src/ts/cp.ts',
},

the files that impact the compiled output of index.ts are under /templates and the files that impact the output of cp.ts are under /config. So I have:

viteRestart({
	reload: ['templates/**/*', 'config/**/*'],
})

I would love the ability to allow these restarts to affect only certain pages on the front end. Specifically, changes to config cause a reload of everything under /admin, and changes to templates cause a reload of everything else.

Suggested solution

One suggestion for the configuration would be to allow the reload configuration to take an array of objects:

viteRestart({
	reload: [{
                src: 'templates/**/*',
                pages: '^[^(admin)].*' // reload pages not starting with 'admin'
        }, {
               src: 'config/**/*'],
               pages: '^(admin).*' // reload pages starting with 'admin'
       }
})

Alternative

No response

Additional context

No response

Validations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions