Comments (4)
Producing a UMD build can easily be done with browserify – which is something we could add, so I don't really see the need to convert to ESM here (yet) – unless you have some convincing arguments?
from node-envelope.
Besides the ESM support already available in Node 12 through the --experimental-modules
flag, IIRC, browserify, unlike Rollup, doesn't support making an ESM distribution, so one couldn't have an ESM build that could be imported in the browser). (I can't Google now to find the issue, as behind firewall in China with no working VPN.)
I like to use ESM in browser demos as it allows working against source without a build step. But this is not a pressing need for me at the moment. I just figured if making the steps to ensure the bundles worked in the browser, that one might as well future-proof the code and provide that functionality along the way.
from node-envelope.
IIRC, browserify, unlike Rollup, doesn't support making an ESM distribution, so one couldn't have an ESM build that could be imported in the browser).
Right – that's not supported yet. Would having dedicated browserify bundle with a global export help with that (i.e. browser/envelope.min.js
which exposes Envelope
)? I'm not familiar with rollup, but I'll test some things later and let you know what the conclusions are.
from node-envelope.
A global export would be helpful, sure, whether in a browser-specific build (wrapping the code in an IIFE to avoid conflicts and just setting the global window
, this
, or self
), or UMD (i.e., combining global setting with Node/CJS and AMD support). (Rollup exposes these with its output.format
as "iife" or "umd", or also allowing "cjs" for Node only and "esm" for the proposed ESM distribution.)
So while a regular global would satisfy the major concern of this issue, I happen to prefer ESM for avoiding any globals or keeping track of dependencies out of context within my HTML.
Rollup is very well documented and easy to setup and use (compared to Webpack or even Browserify), with the small caveat that you generally need to use plugins when importing npm dependencies (@rollup/plugin-node-resolve
, and if the deps. don't themselves have an ESM export, e.g., as indicated in module
of package.json
, then also @rollup/plugin-commonjs
and if you need native Node module polyfills for the browser, possibly rollup-plugin-node-builtins
) or if replacing require
of JSON (i.e., @rollup/plugin-json
); and to minify one needs rollup-plugin-terser
or such (and if babelifying, rollup-plugin-babel
--all of which I have found work well).
Rollup also has the advantage of working with parcel, a popular means of making it easy to smoothly facilitate the installation of modules without users needing to manually manage this config.
from node-envelope.
Related Issues (20)
- Implement Envelope#toString()
- Encoding error HOT 5
- Parsing quote-printable body content problem HOT 3
- message body not decoded when contentTransferEncoding is uppercase HOT 1
- mails with format ASCII only LF line endings are not parsed HOT 5
- Quoted-printable strings in subject not decoded correctly HOT 5
- Typescript definition HOT 1
- Update & improve documentation
- node-imap HOT 3
- erroneous subject field parsing (and possibly other fields to?)
- erroneous parsing of from field HOT 2
- Error: missing header HOT 3
- envelope doesn't parse more than 1 attachment HOT 2
- Implement a streaming parser
- Implement header field transforms
- Add a plugin system
- Implement body part transforms
- Implement un/serialization HOT 3
- Implement header field validation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-envelope.