-
Notifications
You must be signed in to change notification settings - Fork 915
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
esinstall: handle cjs auto-named-exports with deep reexports #1194
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/9c0h387g3 |
955d15d
to
2be580c
Compare
@@ -92,7 +98,7 @@ export function rollupPluginWrapInstallTargets( | |||
const cjsExports = isExplicitAutoDetect | |||
? cjsAutoDetectExportsRuntime(val) | |||
: cjsAutoDetectExportsStatic(val); | |||
if (cjsExports) { | |||
if (cjsExports && cjsExports.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
const resolvedReexports = reexports.map((e) => | ||
cjsAutoDetectExportsStatic(require.resolve(e, {paths: [path.dirname(filename)]}), visited), | ||
); | ||
return Array.from(new Set([...exports, ...resolvedReexports])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@@ -0,0 +1 @@ | |||
module.exports = require('./reexported'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! This is awesome we’re handling this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look good!
Changes
Testing
Docs