Skip to content

[Bug] Stringify remove spaces and new lines from template literal #81

Description

@ryuran

Describe the bug

Stringify unexpectedly remove spaces and new lines from template literal

Steps to reproduce the behavior

stringify({
  f: () => `
    1
    2
    3
  `,
})

result :

{"f":"_function_f|() => `123`"}

Expected result

{"f":"_function_f|() => `\n    1\n    2\n    3\n  `"}

Environment

  • OS: macOS
  • Node.js version: v14.16.1
  • NPM version: v7.24.2
  • Browser (if applicable): chrome, firefox…
  • Browser version (if applicable): firefox 101.0, chrome 102.0.5005.61

Additional context

Telejson is used under the hood of storybook and fail to "teleport" function containing template literal without loosing spaces and new line in webpack devServer environement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions