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

SVGR fails silently when there is no imports and exports in provided template #223

Closed
xcrzx opened this issue Nov 6, 2018 · 0 comments
Closed

Comments

@xcrzx
Copy link

xcrzx commented Nov 6, 2018

🐛 Bug Report

Skipping imports and exports in the template provided to @svgr/core config result in empty output.
If I add either imports or exports to the template everything work as expected.

To Reproduce

const result = await svgr(
    '<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M3 3.8V3h11v.8l-4 4.8V14l-3-1.5V8.6z" fill-rule="evenodd"/></svg>', 
    {
     template: ({ template }, opts, { jsx }) => template.ast`${jsx};`,
});
console.log(result) // Empty string

Expected behavior

Expect result to contain jsx code.

Link to repl or repo (highly encouraged)

https://github.com/xcrzx/svgr-template-issue

Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard

Paste the results here:

## System:
 - OS: macOS 10.14
 - CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
 - Memory: 127.24 MB / 16.00 GB
 - Shell: 5.3 - /bin/zsh
## Binaries:
 - Node: 11.0.0 - ~/.nvm/versions/node/v11.0.0/bin/node
 - Yarn: 1.12.1 - /usr/local/bin/yarn
 - npm: 6.4.1 - ~/.nvm/versions/node/v11.0.0/bin/npm
 - Watchman: 4.9.0 - /usr/local/bin/watchman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants