Skip to content

Commit

Permalink
fix!: workaround vue ssr cannot resolve lazy load components in subdir
Browse files Browse the repository at this point in the history
related to vuejs/vue#12924

Signed-off-by: Chawye Hsu <[email protected]>
  • Loading branch information
chawyehsu committed Jan 19, 2025
1 parent 2b30cae commit 4acabb9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/@alterjs/saber/src/utils/getFileNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
*/
export default function getFileNames(useHash: boolean) {
return {
js: useHash ? 'js/[name].[chunkhash:8].js' : 'js/[name].js',
// FIXME(chawyehsu):
// Ideally we want all js files to be placed in the `js/` subdirectory,
// but vue-server-renderer 2.x has a bug [1] with webpack 5 that it cannot
// resolve the correct path of the component that is imported using `import()`.
//
// [1]: https://github.com/vuejs/vue/issues/12924
js: useHash ? '[name].[chunkhash:8].js' : '[name].js',
css: useHash ? 'css/[name].[chunkhash:8].css' : 'css/[name].css',
font: useHash ? 'fonts/[name].[hash:8].[ext]' : 'fonts/[path][name].[ext]',
image: useHash
Expand Down

0 comments on commit 4acabb9

Please sign in to comment.