-
Notifications
You must be signed in to change notification settings - Fork 4
Troubleshooting Javascript syntax version #89
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
Troubleshooting Javascript syntax version #89
Conversation
esezen
left a comment
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.
@mocca102 This is looking good. I left some comments, let me know what do you think about them. We can adjust or ignore if you don't like them
README.md
Outdated
|
|
||
| ### Known Issues | ||
|
|
||
| **Javascript version** |
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.
Can we do "Older Javascript versions"?
README.md
Outdated
|
|
||
| **Javascript version** | ||
|
|
||
| The default exported javascript syntax is ESNext, the latest supported syntax of JavaScript. |
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.
What do you think about this?
This library exports two different versions
- CommonJS (cjs)
- ECMAScript Modules (mjs)
If you are using an import statement, mjs version will be imported.
If you are using a require statement, cjs version will be imported.
Since mjs version is compiled to ESNext, there could be features that are not supported by older Node versions (ex. optional chaining). If you are receiving an error similar to the following error, please import the cjs version which is compiled to ES2015.
import CioQuiz from '@constructor-io/constructorio-ui-quizzes/commonJs'
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.
If you are using an import statement, mjs version will be imported.
If you are using a require statement, cjs version will be imported.
Settled on Slack
esezen
left a comment
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.
@mocca102 thanks for making the changes. I still think it's important to mention the differences between import and require but I might be wrong. Do you mind bringing this to standup tomorrow so we can discuss with the team?
package.json
Outdated
| "import": "./lib/mjs/index.js", | ||
| "require": "./lib/cjs/index.js" | ||
| }, | ||
| "./commonJs": { |
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.
I could swear I left a comment here but it somehow disappeared.
Do you have a preference cjs vs commonJs? If not, can we do cjs?
esezen
left a comment
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.
LGTM!
No description provided.