Skip to content

Commit

Permalink
feat: add auto config for svite
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Mar 10, 2021
1 parent c60643a commit 24599a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
18 changes: 18 additions & 0 deletions configs/svite-legacy-routify.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
name: 'Svite legacy / Routify 2',
supersedes: ['routify2', 'routify'],
condition: ({ pkgjson }) => pkgjson.dependencies['svite'],
config: () => {
const { readFileSync } = require('fs')
const html = readFileSync('./dist/index.html', 'utf-8')
const script = html.match(/src="\/(_assets\/index.\w+.js)"/)[1]
return {
script: `dist/${script}`,
entrypoint: 'dist/index.html',
inlineDynamicImports: true,
sitemap: '.routify/urlIndex.json',
output: 'dist',
eventName: 'app-loaded',
}
}
}
12 changes: 6 additions & 6 deletions configs/svite-routify.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
name: 'Svite / Routify 2',
supersedes: ['routify2', 'routify'],
condition: ({ pkgjson }) => pkgjson.dependencies['svite'],
condition: ({ pkgjson }) => pkgjson.dependencies['@svitejs/vite-plugin-svelte'],
config: () => {
const { readFileSync } = require('fs')
const html = readFileSync('./dist/index.html', 'utf-8')
const script = html.match(/src="\/(_assets\/index.\w+.js)"/)[1]
const html = readFileSync('./dist/index.html', 'utf8')
const script = html.match(/<script .+?src="([^"]+)"/)[1]
return {
script: `dist/${script}`,
sitemap: '.routify/urlIndex.json',
script: `dist${script}`,
entrypoint: 'dist/index.html',
inlineDynamicImports: true,
sitemap: '.routify/urlIndex.json',
output: 'dist',
outputDir: 'dist',
eventName: 'app-loaded',
}
}
Expand Down

0 comments on commit 24599a5

Please sign in to comment.