You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into an issue while using web audio workers. It seems there isn't a target that uses globalThis instead of self. The code causing the issue is below.
I have tried changing the globalObject in my webpack config but it seems webpack-dev-server doesn't use this option.
output: {globalObject: "globalThis"}
I also tried setting the target to webworker but the error persists.
Expected Behavior
Either code generated should use the globalObject set by webpack or default to globalThis.
Or the self code portions should not be included in web worker output.
How Do We Reproduce?
Create a audio worker using code compiled by webpack-dev-server and register it using the same name as below; "realtime-audio". The audio worker file should be complied to a separate bundle. See https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode for another complete example.
i.e. you disable client and hot on your audio worklet.
But there is a small problem, you can't use dev server options for the first compilation, but we are working on it webpack/webpack-cli#4045 and release will be soon, after cut a release you can do such things:
module.exports=[{entry: "./src/index.js",mode: "development",output: {path: path.resolve(__dirname,"./dist"),filename: "main.js",},devServer: {// Your options for dev server}},{entry: "./src/audio.js",mode: "development",target: "webworker",output: {publicPath: "",path: path.resolve(__dirname,"./dist"),filename: "audio.bundle.js",},devServer: false}];
Bug report
I'm running into an issue while using web audio workers. It seems there isn't a target that uses globalThis instead of self. The code causing the issue is below.
webpack-dev-server/client-src/index.js
Lines 149 to 151 in 540c438
AudioWorkletGlobalScope
defines the only scope available to a web audio worker.Actual Behavior
I have tried changing the globalObject in my webpack config but it seems webpack-dev-server doesn't use this option.
I also tried setting the target to
webworker
but the error persists.Expected Behavior
Either code generated should use the globalObject set by webpack or default to
globalThis
.Or the
self
code portions should not be included in web worker output.How Do We Reproduce?
Create a audio worker using code compiled by webpack-dev-server and register it using the same name as below; "realtime-audio". The audio worker file should be complied to a separate bundle. See https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode for another complete example.
audio.ts
main.ts
This should trigger the error.
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: