-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
WIP: fix: restore default export #705
Conversation
Code Climate has analyzed commit 32e7a4e and detected 0 issues on this pull request. View more on Code Climate. |
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.
Thanks for this solution
I think it could work if we do
export = sgd
instead of
export default sgd
line 30 in main.ts
Then we won't need to have the index.cjs
file
What do you think @pawel-id, could you test it on your side ?
@@ -1,5 +1,5 @@ | |||
{ | |||
"extends": "./node_modules/@salesforce/dev-config/tsconfig", | |||
"extends": "./node_modules/@salesforce/dev-config/tsconfig.json", |
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.
question: why should we add the extension here?
Is it solving something ?
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.
tsconfig.json change shouldn't be there. Please ignore it.
checking the solution with export = sgd
...
const sgd = require('./main.js').default | ||
module.exports = sgd |
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.
praises: Smart way to workaround
@scolladon This works and it is super simple! |
Explain your changes
It seems typescript clause
export default someting
is translated intoexports.default = sgd;
which is somehow different that expectedmodule.exports = sgd
. Then having this approach in order to import this we need to do some extra work:or
This is some proposal of solving the issue which I found. It is rather provided as example, not necessarily to merge (maybe there is smarter way).
related to #701