diff --git a/packages/svelte2tsx/src/svelte2tsx/nodes/Scripts.ts b/packages/svelte2tsx/src/svelte2tsx/nodes/Scripts.ts index 853a72fd1..560e00de0 100644 --- a/packages/svelte2tsx/src/svelte2tsx/nodes/Scripts.ts +++ b/packages/svelte2tsx/src/svelte2tsx/nodes/Scripts.ts @@ -35,7 +35,11 @@ export class Scripts { if ( tag.attributes && tag.attributes.find( - (a) => a.name == 'context' && a.value.length == 1 && a.value[0].raw == 'module' + (a) => + (a.name == 'context' && + a.value.length == 1 && + a.value[0].raw == 'module') || + a.name === 'module' ) ) { moduleScriptTag = tag; diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/expectedv2.ts new file mode 100644 index 000000000..6406a56c2 --- /dev/null +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/expectedv2.ts @@ -0,0 +1,15 @@ +/// +; + export function preload() {} + let b = 5; +;;function render() { + + let world = "name" +; +async () => { + + { svelteHTML.createElement("h1", {}); world; }}; +return { props: {world: world}, slots: {}, events: {} }} + +export default class Input__SvelteComponent_ extends __sveltets_2_createSvelte2TsxComponent(__sveltets_2_partial(['world'], __sveltets_2_with_any_event(render()))) { +} \ No newline at end of file diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/input.svelte b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/input.svelte new file mode 100644 index 000000000..9465aa0d6 --- /dev/null +++ b/packages/svelte2tsx/test/svelte2tsx/samples/module-script-and-script3.v5/input.svelte @@ -0,0 +1,8 @@ + + +

hello {world}