1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pixi.js ではサウンドをサポートをしていない?require-is-not-defined

Last updated at Posted at 2019-07-10

pixi.jsではサウンドをサポートしていません。
別にあるpixi-sound.jsという音のみをサポートするフレームワークを別途導入する必要があるようです。

早速、CDN版を入れたところ、
https://www.jsdelivr.com/package/npm/pixi-sound
以下のエラー
スクリーンショット 2019-07-11 午前0.45.16.png

TypeScript(.ts)形式で作られ始める前までの2.1.3で動かしたところ、動作は確認できました。
https://github.com/pixijs/pixi-sound/releases/tag/v2.1.3

2.1.4以降でなぜエラーが出るのかは調査中です。

https://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-require-is-not-defined
require()は、WebブラウザのJavaScriptで存在していないため、以下の3つの方法で解決できるとか

1 Use <script> tag.
2 Use a CommonJS implementation. Synchronous dependencies like Node.js
3 Use an AMD implementation.

実施結果は追々。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?