What's the replacement of svelte/register for Svelte 4?

190 views Asked by At

I have this project svelte-mpa, what's that I tried to upgrade to svelte-4, but svelte/register already deprecated on svelte-4. What's the proper replacement of it?

1

There are 1 answers

0
Kokizzu On BEST ANSWER

nevermind, just use svelte/compiler works, change

require('svelte/register')

to

const compile = require('svelte/compiler').compile

then change

const renderedSvelte = require(path + '.svelte').default.render()

to

const renderedSvelte = compile(path + '.svelte')