Skip to content

Commit

Permalink
Fix dynamic import of howler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajaniraiyn committed Nov 1, 2024
1 parent a95ebc9 commit 1724ee2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Sound {
* Creates the Howl instance for the sound.
*/
private async create() {
const { Howl } = await import("howler/src/howler.core");
const { Howl } = await import("howler");
const { loop, volume } = this.options;
const sound: THowl = new Howl({
src: this.src,
Expand Down
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ export default defineConfig({
entry: "src/sound.ts",
formats: ["es", "cjs"],
},
rollupOptions: {
external: ["howler"],
output: {
globals: {
howler: "Howler",
},
},
},
},
plugins: [dts()],
});

0 comments on commit 1724ee2

Please sign in to comment.