Open AppleIsCute opened 11 months ago
I assume you are using a node server? Hard to know exactly what might be causing your issue without seeing your project setup.
The README might have helpful info on how to import Tonal
into your project.
I tested both of the examples below and work ok. Hopefully, that helps! 🤝
HTML (client side)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/tonal/browser/tonal.min.js"></script>
<script>
console.log(Tonal.Mode.all());
</script>
</body>
</html>
Node.js(server-side)
const { Mode } = require('tonal');
console.log(Mode.all());
Hi, I'm trying to write a music web with this library. I'm a rookie developer so I'm not sure if the following error is my own problem. I'm trying to import the mode module into my web app so I write this in my html:
<script type="module"> import { Mode } from "./node_modules/@tonaljs/mode/dist/index.js";</script>
(node_modules is a file generated while downloading the tonaljs package and all the modules are in it )And I got error from my console:
Uncaught SyntaxError: The requested module './node_modules/@tonaljs/mode/dist/index.js' does not provide an export named 'default'
For further info, the following is the index.ts. while running the web on localhost:
And if i do
import * as Mode from "./node_modules/@tonaljs/mode/dist/index.js";
, it shows the error message :module is not defined
I'm not sure how to fix this.