Skip to content

Conversation

@rejc2
Copy link

@rejc2 rejc2 commented Jan 23, 2023

Following the approach recommended in the Node.js documentation:

https://nodejs.org/api/packages.html#approach-1-use-an-es-module-wrapper

Reason for change

Currently if you import the 'wavefile' package from an ES module in Node, Node will use the CommonJS module in dist/wavefile.js and treat the object exported there as the default export.
This means that in order to get the WaveFile class, you will need to do:

import waveFileModule from 'wavefile';
const { WaveFile } = waveFileModule;

rather than the expected pattern of:

import { WaveFile } from 'wavefile';

The change in this PR re-exports WaveFile in a ESM wrapper module.

@rejc2 rejc2 force-pushed the rejc2/esm-wrapper branch from a3d3839 to fd962d8 Compare January 24, 2023 02:21
rejc2 and others added 3 commits January 23, 2023 20:22
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

Successfully merging this pull request may close these issues.

4 participants