import { createRequire } from 'module' ; const require = createRequire ( import . meta . url ) ; const tildeImporter = ( url ) => { if ( url . includes ( '~' ) ) { url = url . replace ( '~' , '' ) ; if ( ! url . includes ( '.scss' ) ) { url += '.scss' ; } url = require . resolve ( url ) ; } return { file : url } ; } ; export async function compileSass ( filePath ) { const { renderSync } = require ( 'sass' ) ; const { css } = renderSync ( { file : filePath , importer : tildeImporter } ) ; return css ; }