-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multline strings + webpack + storybook gives syntax error #1405
Comments
@askoufis I was wrong in my original report - I've updated the reproduction to properly demonstrate one version working, and one being broken. |
This is affecting quite a few of my projects. Unless anyone is looking at this already, will submit a PR tomorrow. |
What a rabbit hole. TL;DR, the multi-line string in the reproduction ends up as roughly (because of SWC, see extra notes below): "\n 0px 0px 0px 4px #DEEFFF\n " This used to be correctly dedented by I'll get a fix out for this soon. Extra notesI was stumped for a while trying to reproduce it within VE's test suite. I was seeing identical output between It turns out that swc targets ES3 syntax by default. This results in all template strings being converted to regular strings, because template strings were only added in ES6. In the case of multi-line strings, you end up with something like the code snippet above. So an alternative way to fix this is to configure storybook to either not use SWC, or configure SWC to target ES6 or greater: // .storybook/main.js
const config = {
swc: (config) => {
return {
...config,
jsc: {
...config.jsc,
target: "es6",
},
};
},
} Obviously fixing the the issue within VE is the best option, but I'm glad I'm at least aware of potential Storybook + SWC issues going forward. |
⭐ , Thanks @askoufis! |
Describe the bug
For some reason, backticks are replaced by
"
which gives a syntax error.Regression is in
@vanilla-extract/integration@7.1.3
-7.1.2
(likeoverrides
in the reproduction forces) works correctly.Reproduction
https://github.com/SimenB/vanilla-multiline-storybook-bug
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: