Skip to content
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

Native ES6 Module support #3

Closed
75lb opened this issue Sep 3, 2018 · 5 comments
Closed

Native ES6 Module support #3

75lb opened this issue Sep 3, 2018 · 5 comments

Comments

@75lb
Copy link

75lb commented Sep 3, 2018

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
Copy link
Contributor

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'

@75lb
Copy link
Author

75lb commented Sep 3, 2018

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.

@SheetJSDev
Copy link
Contributor

SheetJSDev commented Sep 4, 2018

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/[email protected]/printj.mjs';
sprintf("Hello %s", "World!");

@75lb
Copy link
Author

75lb commented Sep 4, 2018

works great, thanks! 👍

@mahadev-Pandhare
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants