Skip to content

Some comments #27

@smrg-lm

Description

@smrg-lm

Hey

Instead of flooding the repo with issues I'll post all observations here. In relation to #26 I found some things that I don't quite understand and some possible issues.

  • It strikes me as odd that builds for cjs defaults to --format=iife since that's a client-side format. For the bundle distribution in iief format there is an entry in package.json named "browser" recognized by esbuild that could be used. And there are two "build-cjs" and "build-cjs-bundle" and the same for esm. Maybe with three targets cjs, ems for server side and one bundled ems for client side is sufficient.

  • Since index.d.ts is copied to each different dist maybe it could be put in the root of dist and the referenced with "types": "dist/index.d.ts" in package.json.

  • There is a newer version of esbuild with a medium security patch that could be updated. The build process seems to work ok with with new version.

  • There is a warning when building the types that says may cause unexpected outputs:

npm run build-types

> @grame/[email protected] build-types
> dts-bundle-generator -o dist/cjs/index.d.ts src/index.ts --external-imports

Compiling input files...
Processing src/index.ts
Library "emscripten" will be added via reference directive
The following type nodes were renamed because of the name collisions and will not be exported from the generated bundle:
- AudioData (from /Faust/faustwasm.git/src/types.d.ts)
This might lead to unpredictable and unexpected output, and possible breaking changes to your API.
Consider either (re-)exporting them explicitly from the entry point, or disable --export-referenced-types option ('output.exportReferencedTypes' in the config).
Writing src/index.ts -> dist/cjs/index.d.ts
Checking generated files...
Done in 5.42s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions