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

Scope hoisting: import * with re-exporting does not include all exports #4216

Closed
wbinnssmith opened this issue Feb 24, 2020 · 3 comments · Fixed by #4387
Closed

Scope hoisting: import * with re-exporting does not include all exports #4216

wbinnssmith opened this issue Feb 24, 2020 · 3 comments · Fixed by #4387

Comments

@wbinnssmith
Copy link
Contributor

wbinnssmith commented Feb 24, 2020

🐛 bug report

In the following case with scope hoisting enabled, using import * with the @sentry/browser package does not include all of its exports. This package re-exports quite a bit.

🎛 Configuration (.babelrc, package.json, cli command)

Defaults, parcel2 build --no-minify

🤔 Expected Behavior

All of the exports should be included when importing using import *

😯 Current Behavior

Only subset of exports is included.

💻 Code Sample

yarn add @sentry/browser

import * as Sentry from '@sentry/browser';

Sentry.configureScope(scope => console.log('scope', scope));
console.log('Sentry', Sentry);

and build with parcel2 build --no-minify index.js

The above logs:

Sentry {
  Transports: {
    BaseTransport: [Function: BaseTransport],
    FetchTransport: [Function: FetchTransport],
    XHRTransport: [Function: XHRTransport]
  },
  Integrations: {
    FunctionToString: [Function: FunctionToString] { id: 'FunctionToString' },
    InboundFilters: [Function: InboundFilters] { id: 'InboundFilters' },
    GlobalHandlers: [Function: GlobalHandlers] { id: 'GlobalHandlers' },
    TryCatch: [Function: TryCatch] { id: 'TryCatch' },
    Breadcrumbs: [Function: Breadcrumbs] { id: 'Breadcrumbs' },
    LinkedErrors: [Function: LinkedErrors] { id: 'LinkedErrors' },
    UserAgent: [Function: UserAgent] { id: 'UserAgent' }
  }
}

...but should include @sentry/browser's other exports, such as configureScope and captureException.

🌍 Your Environment

Software Version(s)
Parcel v2 branch (04f2e66)
Node v12.16.1
npm/Yarn yarn 1.21.1
Operating System macOS 10.15.3
@wbinnssmith
Copy link
Contributor Author

cc @mischnic @devongovett

@wbinnssmith wbinnssmith changed the title import * with re-exporting does not include all exports Scope hoisting: import * with re-exporting does not include all exports Feb 24, 2020
@mischnic
Copy link
Member

Seems to be related to/caused by sideEffects: false

@mischnic
Copy link
Member

mod.meta.exportsIdentifier is being inserted here, which refers to the reexporting asset which was excluded. It should instead be somehow resolved through to the actual asset.

let name = assertString(mod.meta.exportsIdentifier);

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