-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Document how to use package with require
#81
Comments
With state, the code is currently in
the const bundle = require('@asyncapi/bundler').default; or, if export in const { bundle } = require('@asyncapi/bundler'); which are both nonsatisfying (because But it seems that the need of having both export default async function bundle()
export { Document }; in export = bundle; the example TS&JS programs are still able to use So it is my assumption that |
@aeworxet I wonder if
However, I opt for exporting bundle function also as named export, so we will have: export default async function bundle() {...}
export { Document, bundle }; and people in ESM will be able to import it as: import bundle from '...';
// OR
import { bundle } from '...'; but in CJS as: const { bundle } = require('...'); |
The library has not yet reached version |
it is not about and it has over 2k weekly downloads anyway, it is breaking change, no matter what version we have, just for the record 😄 I'm ok if the world will look like:
more important is to fix and document it |
The change export = bundle; will be applied to source file module.exports = bundle; during build stage.
so it will also be a bugfix for the breaking change. I have temporarily removed I also included two files
to clearly illustrate to users the difference (both these files can also be included in future documentation). When continuing experimentation, specifying
in and I'm assuming the package will target exactly Node.js projects, but might there be any other uses predicted? |
New version of the bugfix for the breaking change.
syntax, is easily transpiled with Babel (
and can be used by both To achieve this, generation of TS declaration files during build stage was removed, as they do not seem to be needed in a JS NPM package anyway, but were confusing |
…ncapi#81) Co-authored-by: Maciej Urbańczyk <urbanczyk.maciej.95@gmail.com> Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
It turned out that
and
co-habitate in the code just fine. |
After migration to TS in readme we focus only on examples with
import
.We need examples with
require
. Especially that before migrationconst bundle = require('@asyncapi/bundler');
worked well before0.3
and now it doesn't.I think we can consider it also a breaking change 🤔
The text was updated successfully, but these errors were encountered: