syncfusion / ej2-javascript-ui-controls

Syncfusion JavaScript UI controls library offer more than 50+ cross-browser, responsive, and lightweight HTML5 UI controls for building modern web applications.
https://www.syncfusion.com/javascript-ui-controls
Other
400 stars 158 forks source link

The esm files inside `dist/es6` folder should end with `.mjs` #178

Open viceice opened 6 months ago

viceice commented 6 months ago

The esm files inside dist/es6 folder should end with .mjs, otherwise those files are not correctly resolved by test runner, because they assume cjs by default.

Alternate is to add a simple package.json:

{ "type": "module" }

so nodejs based resolvers know that those files are esm.

viceice commented 6 months ago

maybe better add "type": "module" to the root package.json and add cjs extension to the umd files.

Mohamed7Imran commented 4 months ago

Hi Viceice,

Thank you for sharing your concern with us. We've carefully considered your feedback regarding the file extensions within the dist/es6 folder.

Based on your concern, we'd like to provide some insight into our implementation approach. Our components are designed to support multiple targets, accommodating both ES5 and ES6 specifications. After careful consideration, when changing the module's extension to (.mjs), we may face potential compatibility issues that arise with older versions of Node.js. Specifically, Node.js version 11 and earlier may encounter challenges with the use of ES6 modules (.mjs files). In such cases, adhering to CommonJS modules (.js files) is the best way for us to provide optimal stability and compatibility for our packages across different specifications.

Please feel free to reach out if you have any further concerns.

Best regards, Mohamed

viceice commented 4 months ago

ok, alternatively add a package.json with this content to the es6 folder:

{ "type": "module" }

this will inform newer nodejs versions that those files are esm instead of commonjs files

Mohamed7Imran commented 3 months ago

Hi Viceice,

Thank you for getting back to us.

We appreciate your suggestion regarding adding { "type": "module" } to the package.json file in the es6 folder to indicate that the files are ECMAScript Modules (ESM). We value your input.

However, we need to consider potential compatibility issues with our packages in older versions of Node.js, particularly versions 11 and earlier. Before Node.js version 12, full support for ECMAScript Modules (ESM) was not available. While Node.js 12 introduced experimental support for ESM, it only became fully stable in Node.js 13 and later versions. Older versions of Node.js may not properly interpret the type: "module" declaration in the package.json and could encounter issues when executing the ES modules.

Given that our components need to support a wide range of Node.js versions, including older ones, it's crucial for us to consider the potential impact of using ECMAScript Modules (ESM) across different environments.

If you have any further concerns or questions, please don't hesitate to reach out to us. We're here to help!

Best regards, Mohamed

viceice commented 2 months ago

this won't break old nodejs, because they simply ignore the additional package.json