@@ -91,17 +91,25 @@ export default defineConfig(({ command, mode }) => {
9191 }
9292 ] ,
9393 resolve : {
94- alias : [
95- { find : '$lib' , replacement : fileURLToPath ( new URL ( './src/lib' , import . meta. url ) ) } ,
96- { find : '$workers' , replacement : fileURLToPath ( new URL ( './src/workers' , import . meta. url ) ) } ,
94+ alias : {
95+ '$lib' : fileURLToPath ( new URL ( './src/lib' , import . meta. url ) ) ,
96+ '$workers' : fileURLToPath ( new URL ( './src/workers' , import . meta. url ) ) ,
97+
98+ // Map specific Svelte sub-paths back to the real runtime so they are **not** redirected to
99+ // our shim (which would cause ENOTDIR errors like svelte-shim.js/store).
100+ 'svelte/internal' : resolve ( __dirname , 'node_modules/svelte/internal' ) ,
101+ 'svelte/store' : resolve ( __dirname , 'node_modules/svelte/store' ) ,
102+ 'svelte/transition' : resolve ( __dirname , 'node_modules/svelte/transition' ) ,
103+ 'svelte/animate' : resolve ( __dirname , 'node_modules/svelte/animate' ) ,
104+ 'svelte/easing' : resolve ( __dirname , 'node_modules/svelte/easing' ) ,
105+ 'svelte/motion' : resolve ( __dirname , 'node_modules/svelte/motion' ) ,
97106
98107 // Real runtime entry alias so the shim can import without causing an alias loop.
99- { find : 'svelte-original' , replacement : resolve ( __dirname , 'node_modules/svelte/src/runtime/ index.js' ) } ,
108+ 'svelte-original' : resolve ( __dirname , 'node_modules/svelte/index.mjs' ) ,
100109
101- // Match bare 'svelte' import only (exact match, not sub-paths)
102- // Sub-path imports like svelte/internal, svelte/store are resolved via package.json exports
103- { find : / ^ s v e l t e $ / , replacement : fileURLToPath ( new URL ( './src/svelte-shim.js' , import . meta. url ) ) } ,
104- ]
110+ // Any other bare `import "svelte"` should go to our shim that adds mount/unmount.
111+ 'svelte' : fileURLToPath ( new URL ( './src/svelte-shim.js' , import . meta. url ) ) ,
112+ }
105113 } ,
106114 clearScreen : false ,
107115 server : {
@@ -139,7 +147,9 @@ export default defineConfig(({ command, mode }) => {
139147 'vendor-editor' : [ 'svelte-jsoneditor' , '@tiptap/core' , '@tiptap/starter-kit' , 'tiptap-markdown' ] ,
140148 'vendor-charts' : [ 'd3' ] ,
141149 'vendor-atomic' : [ '@tomic/lib' , '@tomic/svelte' ] ,
142- 'vendor-utils' : [ 'comlink-fetch' , 'svelte-routing' , 'tinro' , 'svelte-markdown' ]
150+ 'vendor-utils' : [ 'comlink-fetch' , 'svelte-routing' , 'tinro' , 'svelte-markdown' ] ,
151+ // Large components
152+ 'novel-editor' : [ '@paralect/novel-svelte' ]
143153 }
144154 }
145155 } ,
0 commit comments