Skip to content

Conversation

@rejc2
Copy link

@rejc2 rejc2 commented Jan 24, 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 'prx-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 'prx-wavefile';
const { WaveFile } = waveFileModule;

rather than the expected pattern of:

import { WaveFile } from 'prx-wavefile';

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

@kookster
Copy link
Member

I don't see a great way to test this off hand, but this breaks none of the tests, so I'm fine with merging

@kookster kookster merged commit aefc4be into PRX:master Feb 17, 2023
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.

2 participants