Skip to content

Commit

Permalink
fix: fix plain css reference via link (fix #252)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 25, 2020
1 parent c239067 commit 146a49d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ socket.addEventListener('message', async ({ data }) => {
console.log(`[vite] connected.`)
break
case 'style-update':
const hasQuery = path.includes('?') ? '&' : '?'
await bustSwCache(`${path}${hasQuery}import`)
await import(`${path}${hasQuery}t=${timestamp}`)
const importQuery = path.includes('?') ? '&import' : '?import'
await bustSwCache(`${path}${importQuery}`)
await import(`${path}${importQuery}&t=${timestamp}`)
console.log(`[vite] ${path} updated.`)
break
case 'style-remove':
Expand Down
4 changes: 2 additions & 2 deletions src/node/server/serverPluginCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const cssPlugin: ServerPlugin = ({ root, app, watcher, resolver }) => {
if (!processedCSS.has(ctx.path)) {
await processCss(root, ctx)
}
ctx.type = 'js'
ctx.body = codegenCss(id, processedCSS.get(ctx.path)!.css)
ctx.type = 'css'
ctx.body = processedCSS.get(ctx.path)!.css
}
}
})
Expand Down

0 comments on commit 146a49d

Please sign in to comment.