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

Fix to work with rollup-plugin-typescript2 #147

Merged
merged 2 commits into from
Aug 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/rollup/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function svgrPlugin(options = {}) {
const { babel = true } = options

return {
name: 'svgr',
async transform(data, id) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vwxyutarooo so the problem is here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. However things seems come to fixable on the rollup-plugin-typescript2 issue. So I'll revert the commit around .babelrc anyway!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK nice!

if (!filter(id)) return null
if (id.slice(-4) !== '.svg') return null
Expand Down Expand Up @@ -54,9 +55,13 @@ function svgrPlugin(options = {}) {
)
})

const code = babel ? await pBabelTransform(jsCode) : jsCode
if (babel) {
const code = await pBabelTransform(jsCode);

return { ast, code, map: { mappings: '' } }
return { code, map: { mappings: '' } }
}

return { ast, code: jsCode, map: { mappings: '' } }
},
}
}
Expand Down