diff --git a/src/transformers/scss.ts b/src/transformers/scss.ts index 9aee568e..80790d11 100644 --- a/src/transformers/scss.ts +++ b/src/transformers/scss.ts @@ -37,7 +37,6 @@ const tildeImporter: Importer = (url, prev) => { const modulePath = join('node_modules', ...url.slice(1).split(/[\\/]/g)); - // todo: maybe create a smaller findup utility method? const foundPath = findUp({ what: modulePath, from: prev }); // istanbul ignore if @@ -68,6 +67,7 @@ const transformer: Transformer = async ({ ...options, includePaths: getIncludePaths(filename, options.includePaths), outFile: `${filename}.css`, + omitSourceMapUrl: true, // return sourcemap only in result.map }; const sassOptions = { diff --git a/test/transformers/scss.test.ts b/test/transformers/scss.test.ts index 62873aab..b2539e68 100644 --- a/test/transformers/scss.test.ts +++ b/test/transformers/scss.test.ts @@ -6,6 +6,7 @@ import { resolve } from 'path'; import sveltePreprocess from '../../src'; import { preprocess } from '../utils'; import type { Options } from '../../src/types'; +import { transformer } from '../../src/transformers/scss'; const implementation: Options.Sass['implementation'] = { render(options, callback) { @@ -121,4 +122,17 @@ describe('transformer - scss', () => { }" `); }); + + it('returns the source map and removes sourceMappingURL from code', async () => { + const content = 'div{color:red}'; + const filename = '/file'; + const options = { + sourceMap: true, + }; + + const { map, code } = await transformer({ content, filename, options }); + + expect(code).not.toContain('sourceMappingURL'); + expect(map).toBeTruthy(); + }); });