Skip to content

Commit

Permalink
Add static asset fixer as per (vitejs/vite#2394)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Welch committed Jul 22, 2021
1 parent dcaa583 commit 9383e53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions buildchain/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ export default ({ command }) => ({
],
}),
vue(),
{
name: 'static-asset-fixer',
enforce: 'post',
apply: 'serve',
transform: (code, id) => {
return {
code: code.replace(/\/src\/(.*)\.(svg|jp?g|png|webp)/, 'http://localhost:3000/src/$1.$2'),
map: null,
}
},
},
],
publicDir: '../src/public',
resolve: {
Expand Down

0 comments on commit 9383e53

Please sign in to comment.