Audio is not defined inside node modules #528
Unanswered
growindiedev
asked this question in
Help & Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm building a music player using amplitudejs library. I'm using the new app directory of Next 13. My app works fine in development mode but when I try to make build it or deploy it, it throws an error. I looked into a similar vercel/next.js#17963. But it doesn't help in my scenario. I have isolated the problem but don't know how to fix it. The problem is caused by amplitudejs library. When I remove the amplitudejs import from the component. The build works fine, both in development as well as in production. Here's my repository 🙏🏼
Here's the structure of my component -
`
"use client";
import React, { useEffect, useRef, useContext, useState } from "react";
import { StateContext } from "./StateProvider";
import Amplitude from "amplitudejs";
const AudioPlayer = () => {
const slider = useRef(null);
const { ownedSongs } = useContext(StateContext);
useEffect(() => {
Amplitude?.init({
callbacks: {
timeupdate: function () {
let percentage = Amplitude.getSongPlayedPercentage();
}, [ownedSongs]);
........
.......
``
Beta Was this translation helpful? Give feedback.
All reactions