svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

`replace` does not support source maps

Open benignant opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. The replace preprocessor does not support source maps. I'm using it to replace multiple lines.

Describe the solution you'd like Can the replace transformer use the magic-string replace method?

benignant avatar Jan 15 '23 20:01 benignant

@dummdidumm @benignant does it means processors/replace.ts should have a method which takes file content, options and returns the new formatted content using magicstring.replace method?

Rishab49 avatar Aug 10 '23 15:08 Rishab49

I think the change would go in transformers/replace.ts.

benignant avatar Aug 10 '23 16:08 benignant

@benignant But transformer/replace.ts is doing the same thing as magicstring.replace, then why do you want to change it?

Rishab49 avatar Aug 11 '23 10:08 Rishab49

The magic-string replace method maintains the source map.

benignant avatar Aug 13 '23 17:08 benignant

@benignant Sorry but I can understand your exact requirement.Do you want to use replace method to generate a source map of a given script file using replace method?

Rishab49 avatar Aug 14 '23 10:08 Rishab49