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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope hoisting/tree shaking bug (--experimental-scope-hoisting) #2084

Closed
sergey-shpak opened this issue Sep 30, 2018 · 1 comment 路 Fixed by #2292
Closed

Scope hoisting/tree shaking bug (--experimental-scope-hoisting) #2084

sergey-shpak opened this issue Sep 30, 2018 · 1 comment 路 Fixed by #2292

Comments

@sergey-shpak
Copy link
Contributor

馃悰 bug report

Bundle missing pragma function used to transform jsx to vnodes.

馃帥 Configuration (.babelrc, package.json, cli command)

parcel build ./src/app.js --experimental-scope-hoisting --no-minify

Default babel config

馃 Expected Behavior

Pragma function is not tree shaked from source

馃槸 Current Behavior

Pragma function removed from bundle

In my case: Uncaught ReferenceError: h is not defined

馃拋 Possible Solution

Pragma function imported to source, but the function invocation only occurs in the transpiled source
(after babel-plugin-transform-react-jsx transformations), as result pragma function invocations are not visible for tree shaking and they are removed.

馃敠 Context

馃捇 Code Sample

import { h } from 'hyperapp';
export default <div>test</div>;

馃實 Your Environment

Software Version(s)
Parcel 1.10.1
Node v8.9.4
npm/Yarn
Operating System
@mischnic
Copy link
Member

mischnic commented Oct 4, 2018

as result pragma function invocations are not visible for tree shaking

Tree shaking runs after the babel transformations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants