Skip to content

Commit

Permalink
fix(platform): update path for route invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Nov 24, 2022
1 parent e08f2f7 commit 1f6b8a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ module.exports = {
'scope-enum': [
2,
'always',
['vite-plugin-angular', 'create-analog', 'astro-angular', 'router'],
[
'vite-plugin-angular',
'create-analog',
'astro-angular',
'router',
'platform',
],
],
},
};
12 changes: 11 additions & 1 deletion packages/platform/src/lib/router-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ import type { Plugin } from 'vite';
*/
export function routerPlugin(): Plugin[] {
return [
{
name: 'analogjs-router-config',
config() {
return {
optimizeDeps: {
exclude: ['@analogjs/router'],
},
};
},
},
{
name: 'analogjs-router-invalidate-routes',
configureServer(server) {
function invalidateRoutes(path: string) {
if (path.includes(`${server.config.root}/app/routes`)) {
if (path.includes(`/app/routes/`)) {
server.moduleGraph.fileToModulesMap.forEach((mods) => {
mods.forEach((mod) => {
if (mod.id?.includes('@analogjs_router.js')) {
Expand Down

0 comments on commit 1f6b8a4

Please sign in to comment.