Skip to content
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

Cannot import into React Native Expo app #382

Open
nuno-ferrao opened this issue Jun 9, 2023 · 1 comment
Open

Cannot import into React Native Expo app #382

nuno-ferrao opened this issue Jun 9, 2023 · 1 comment

Comments

@nuno-ferrao
Copy link

Using the following import statement
import { Note } from "tonal";

Leads to the following error on a React Native expo app:

./node_modules/@tonaljs/chord-type/dist/index.mjs 137:5-15 Can't import the named export 'EmptyPcset' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/scale-type/dist/index.mjs 145:5-15 Can't import the named export 'EmptyPcset' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 40:14-22 Can't import the named export 'accToAlt' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 111:9-19 Can't import the named export 'all' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 116:9-19 Can't import the named export 'all' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 121:9-19 Can't import the named export 'all' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 50:23-26 Can't import the named export 'all' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 24:13-21 Can't import the named export 'altToAcc' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 61:9-16 Can't import the named export 'compact' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 46:9-24 Can't import the named export 'coordToInterval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 70:13-28 Can't import the named export 'coordToInterval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 29:12-21 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-type/dist/index.mjs 148:16-25 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-type/dist/index.mjs 161:14-23 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/scale-type/dist/index.mjs 157:16-25 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/scale-type/dist/index.mjs 165:14-23 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 15:19-28 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 100:12-21 Can't import the named export 'deprecate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 135:2-8 Can't import the named export 'detect' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 37:15-19 Can't import the named export 'distance' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 71:23-31 Can't import the named export 'distance' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 31:24-34 Can't import the named export 'freqToMidi' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 34:24-34 Can't import the named export 'freqToMidi' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-type/dist/index.mjs 169:7-12 Can't import the named export 'get' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/scale-type/dist/index.mjs 178:21-26 Can't import the named export 'get' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 65:15-27 Can't import the named export 'get' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 140:14-22 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 46:14-22 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 10:10-15 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 11:22-27 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 12:27-32 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 13:25-30 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 14:21-26 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 16:12-17 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 20:12-17 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 26:9-14 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 66:19-24 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/interval/dist/index.mjs 67:19-24 Can't import the named export 'interval' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 13:159-166 Can't import the named export 'isNamed' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/roman-numeral/dist/index.mjs 13:127-134 Can't import the named export 'isPitch' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 120:19-29 Can't import the named export 'isSubsetOf' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 110:26-38 Can't import the named export 'isSupersetOf' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 115:21-33 Can't import the named export 'isSupersetOf' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 28:9-23 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 31:9-23 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 34:9-23 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 37:9-23 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 68:9-23 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 79:16-30 Can't import the named export 'midiToNoteName' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 46:19-24 Can't import the named export 'modes' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 88:14-18 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 138:12-16 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 9:37-42 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 19:10-15 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/midi/dist/index.mjs 10:12-17 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 66:16-20 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 67:15-19 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 7:19-23 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 9:41-45 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 16:34-38 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 17:6-10 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord-detect/dist/index.mjs 44:22-26 Can't import the named export 'note' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 56:9-14 Can't import the named export 'range' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 63:16-22 Can't import the named export 'rotate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/pcset/dist/index.mjs 115:30-36 Can't import the named export 'rotate' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 36:35-47 Can't import the named export 'tokenizeNote' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 125:21-45 Can't import the named export 'tonicIntervalsTransposer' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 130:9-33 Can't import the named export 'tonicIntervalsTransposer' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 39:16-19 Can't import the named export 'transpose' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/note/dist/index.mjs 40:9-12 Can't import the named export 'transpose' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 84:56-69 Can't import the named export 'transpose' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 106:9-22 Can't import the named export 'transpose' from non EcmaScript module (only default export is available) ./node_modules/@tonaljs/chord/dist/index.mjs 145:0-158:2 Can't reexport the named export 'detect' from non EcmaScript module (only default export is available)

I can't find any resources online to troubleshoot this and I am not sure what the required fix is, as generally speaking the React Native Exp app is compatible with named exports in various formats.

Any help would be much appreciated.

@danigb
Copy link
Collaborator

danigb commented Jun 13, 2023

Hello,

I don't know why this happens. Probably an Expo configuration problem (maybe it does not support es6 modules? don't know). Anyway import { Note } from 'tonal' works in other environments. Nothing I can do. I'll keep it open for a few days. If no one have an answer, I'll close the issue (since I don't think is a tonal related problem).

Good luck

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

No branches or pull requests

2 participants