Skip to content
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

[!] (plugin svelte) TypeError: Cannot read property 'trim' of undefined #235

Closed
DhyeyMoliya opened this issue Sep 1, 2020 · 2 comments · Fixed by #237
Closed

[!] (plugin svelte) TypeError: Cannot read property 'trim' of undefined #235

DhyeyMoliya opened this issue Sep 1, 2020 · 2 comments · Fixed by #237
Assignees
Labels
bug Something isn't working

Comments

@DhyeyMoliya
Copy link

Describe the bug
When I auto format Svelte file in VS Code, it changes the spacings and structure of code a little bit. And when I build it gives this error
[!] (plugin svelte) TypeError: Cannot read property 'trim' of undefined

Logs
build-error

error

To Reproduce
The .svelte file before formatting (works perfectly) :
not-formatted

The .svelte file after formatting (gives build error) :
formatted

Expected behavior
It should work in both scenarios. Because the auto-formatting should not be a problem.

Stacktraces

Stack trace
bundles src/main.ts → public/build/bundle.js...
[!] (plugin svelte) TypeError: Cannot read property 'trim' of undefined
src/main/main.svelte
TypeError: Cannot read property 'trim' of undefined
    at Object.exports.getTagInfo (/Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/svelte-preprocess/dist/modules/tagInfo.js:25:35)
    at /Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/svelte-preprocess/dist/autoProcess.js:80:93
    at Object.transformMarkup (/Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/svelte-preprocess/dist/modules/markup.js:25:45)
    at markup (/Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/svelte-preprocess/dist/autoProcess.js:114:25)
    at preprocess (/Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/svelte/src/compiler/preprocess/index.ts:86:27)
    at Object.transform (/Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/rollup-plugin-svelte/index.js:221:26)
    at /Users/dhyeymoliya/Documents/developer/svelte-app/node_modules/rollup/dist/shared/rollup.js:18615:25

Information about your project:

  • Your browser and the version: N/A

  • Your operating system: OS X 10.15.6

  • svelte-preprocess version : 4.0.0

  • Project uses or Rollup

Additional context
I am using Preprocessor and distributing my .css, .js and .html files outside the .svelte file.

@DhyeyMoliya
Copy link
Author

A temporary workaround for me at this moment is to use prettier-ignore.

Screenshot 2020-09-01 at 2 20 13 PM

@kaisermann kaisermann self-assigned this Sep 1, 2020
kaisermann added a commit that referenced this issue Sep 1, 2020
@kaisermann kaisermann added the bug Something isn't working label Sep 1, 2020
kaisermann added a commit that referenced this issue Sep 1, 2020
@kaisermann
Copy link
Member

kaisermann commented Sep 1, 2020

Thanks! That was indeed an issue 😁 Self-closing tags weren't correctly handled. Fixed in v4.2.1 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants