Native ES6 Module support #3

Closed
opened 2018-09-03 21:48:16 +00:00 by 75lb · 5 comments
75lb commented 2018-09-03 21:48:16 +00:00 (Migrated from github.com)

Any plans to release a native ES6 Module we can use directly in modern browsers?

E.g.

import printj from './node_modules/printj/printj.js'
Any plans to release a native ES6 Module we can use directly in modern browsers? E.g. ``` import printj from './node_modules/printj/printj.js' ```
SheetJSDev commented 2018-09-03 22:14:55 +00:00 (Migrated from github.com)

We don't plan on removing the ES5/CJS bundle that currently exists. We use this in various sites that are built with webpack or rollup with the relevant CJS loader, so the only real case that needs an ES6-export version is the browser script module loader.

We could additionally add an ES6 module that would export the sprintf and vsprintf functions directly (for consistency with the browser, it would have to be called printj.mjs). This is actually pretty easy since the whole thing is built from smaller scripts anyway.

The usage would probably look like:

import { sprintf } from './node_modules/printj/printj.mjs'
We don't plan on removing the ES5/CJS bundle that currently exists. We use this in various sites that are built with webpack or rollup with the relevant CJS loader, so the only real case that needs an ES6-export version is the browser script module loader. We could additionally add an ES6 module that would export the `sprintf` and `vsprintf` functions directly (for consistency with the browser, it would have to be called `printj.mjs`). This is actually pretty easy since the whole thing is built from smaller scripts anyway. The usage would probably look like: ```js import { sprintf } from './node_modules/printj/printj.mjs' ```
75lb commented 2018-09-03 22:29:00 +00:00 (Migrated from github.com)

OK, thanks.. well, in the meantime if anyone else would like to use printj in a native ES6 web app, here is a module you can use until printj supports native ES6 modules.

OK, thanks.. well, in the meantime if anyone else would like to use `printj` in a native ES6 web app, [here is a module](https://gist.github.com/75lb/2af553f67d921aa5ce4111825007cc18) you can use until printj supports native ES6 modules.
SheetJSDev commented 2018-09-04 05:22:37 +00:00 (Migrated from github.com)

Included as printj.mjs in the repo and npm bundle.

https://oss.sheetjs.com/printj/tests/mjs.html is a demo (check the source, it's unminified)

https://plnkr.co/edit/yTANwhsAoStCw5dQoqwC?p=preview is a live version using unpkg:

import { sprintf } from 'https://unpkg.com/printj@1.2.0/printj.mjs';
sprintf("Hello %s", "World!");
Included as `printj.mjs` in the repo and npm bundle. https://oss.sheetjs.com/printj/tests/mjs.html is a demo (check the source, it's unminified) https://plnkr.co/edit/yTANwhsAoStCw5dQoqwC?p=preview is a live version using unpkg: ```js import { sprintf } from 'https://unpkg.com/printj@1.2.0/printj.mjs'; sprintf("Hello %s", "World!"); ```
75lb commented 2018-09-04 10:04:56 +00:00 (Migrated from github.com)

works great, thanks! 👍

works great, thanks! 👍
mahadev-Pandhare commented 2021-09-21 11:06:30 +00:00 (Migrated from github.com)

Is sheetjs pro version support to ES6(ES2015) for angular 12 development by using node modules

Is sheetjs pro version support to ES6(ES2015) for angular 12 development by using node modules
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/printj#3
No description provided.