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: set default pragmaFrag option 🐛 #2486

Merged
merged 1 commit into from Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/core/parcel-bundler/src/transforms/babel/jsx.js
Expand Up @@ -74,7 +74,15 @@ async function getJSXConfig(asset, isSourceModule) {
internal: true,
babelVersion: 7,
config: {
plugins: [[require('@babel/plugin-transform-react-jsx'), {pragma}]]
plugins: [
[
require('@babel/plugin-transform-react-jsx'),
{
pragma,
pragmaFrag: 'React.Fragment'
Copy link
Member

Choose a reason for hiding this comment

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

We will need to create a mapping similar to the one for pragma for other react-alike libraries (preact etc.) if they also support fragments.

Copy link

@adrianmcli adrianmcli Feb 9, 2019

Choose a reason for hiding this comment

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

@lili21 Do you have an idea for how to do this?

EDIT: did some research, see below.

Choose a reason for hiding this comment

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

@devongovett There is no official support for fragments in Preact, NervJS, and HyperApp.

Can't we merge this PR for now and add support for those libraries when they officially support it? It's frustrating to have to add a config for something that is supported to be the default option in Babel.

We are literally forcing users to do more configuration than the default Babel behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree.

}
]
]
}
};
}
Expand Down