Похожие чаты

I'Ve installed tone module by npm. And now want to import

it into a vanilla js file.
This is what I have tried:
import tone from 'tone'

But does not work!
Any solution!?

11 ответов

18 просмотров

import * as Tone from 'tone'

Did you install it globally

Import tone from "./path/to/file/node_modules/tone.js"

Reinstall the module locally

Y- Автор вопроса
david
import * as Tone from 'tone'

I already tried it as well but no difference Should i be using another bundler like common js or sth?

Y- Автор вопроса
J : Vaccinated 🇨🇦
Did you install it globally

Yep But that throws this: Uncaught TypeError: Failed to resolve module specifier "tone". Relative references must start with either "/", "./", or "../".

Y
Yep But that throws this: Uncaught TypeError: Fa...

referring to modules by their names is a nodejs thing, with native es modules in browsers you can only use paths. also it's likely that the module you're trying to import is not written with browser es modules in mind, so you better use a bundler

Y- Автор вопроса
Artem Starikov
referring to modules by their names is a nodejs th...

By using paths, you mean import it locally like from node_modules folder? If so, i tried but throws not found error!

Y
By using paths, you mean import it locally like fr...

use a bundler, e.g. webpack or parcel. I'm 99% sure you're trying to use a module that uses Node.js's module system which is incompatible with browsers' pure ES module system

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта