Skip to content

Commit

Permalink
fix: dynamic register component not found
Browse files Browse the repository at this point in the history
  • Loading branch information
daief committed Oct 9, 2021
1 parent 6cd9c84 commit 5c0b990
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const config: UserConfig = {
const codeResult = hljs.highlight(token.content, {
language: lang,
}).value;
const cname = `C${hash(token.content)}`;
const cname = `C${lang}C${hash(token.content)}`;
fs.writeFileSync(
demoDir(`${cname}.` + (lang === 'html' ? 'vue' : 'tsx')),
token.content,
Expand Down Expand Up @@ -285,14 +285,30 @@ const config: UserConfig = {
extensions: ['vue', 'tsx'],
deep: false,
include: [/\.md$/],
importPathTransform: (pp) => {
console.log('\n1111', pp);
return pp;
},
resolvers: [
(name) => {
const based = resolve(__dirname, 'src/.demo');
if (name.startsWith('CtsxC')) {
return resolve(based, name);
}
if (name.startsWith('ChtmlC')) {
return resolve(based, name + '.vue');
}
},
],
}),
Pages({
extensions: ['vue', 'md'],
}),
VitePWA({
minify: false,
mode: 'development',
}),
// TODO pwa
// VitePWA({
// minify: false,
// mode: 'development',
// }),
],
// @ts-ignore
ssgOptions: {
Expand All @@ -302,7 +318,7 @@ const config: UserConfig = {
resolve: {
alias: {
'daisyui-vue': resolve(__dirname, '..'),
'@': resolve(__dirname, 'src'),
'@/': resolve(__dirname, 'src'),
},
},
build: {},
Expand Down

0 comments on commit 5c0b990

Please sign in to comment.