-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Description
Issues:
- Expected globals are not present, such as
fetch,HeadersReadableStreametc. (this turned out to be a config mishap for ember-cli-fastboot-testing see Config not working embermap/ember-cli-fastboot-testing#488)buildSandboxGlobalno longer runs, so there is no way to enhance the built in globals with WHATWG spec implementations of APIs such asAbortControllerandfetcheven when these things exist as globals in node.fastbootDependenciesdoes not allow whitelisting local dependencies, which prevents applications from addressing this shortcoming short of usingpnpm patchto splice in new globals. For instance the following fails to resolve withFastboot.require
{
"dependencies": {
"fastboot-abort-controller": "file:./fastboot-overrides/abort-controller"
},
"fastbootDependencies": [
"fastboot-abort-controller",
]
}Example recommended config for use with EmberData and fetch
/* global ReadableStream, WritableStream, TransformStream */
module.exports = function (environment) {
return {
buildSandboxGlobals(defaultGlobals) {
return Object.assign({}, defaultGlobals, {
AbortController,
fetch: fetch,
ReadableStream:
typeof ReadableStream !== 'undefined' ? ReadableStream : require('node:stream/web').ReadableStream,
WritableStream:
typeof WritableStream !== 'undefined' ? WritableStream : require('node:stream/web').WritableStream,
TransformStream:
typeof TransformStream !== 'undefined' ? TransformStream : require('node:stream/web').TransformStream,
Headers: typeof Headers !== 'undefined' ? Headers : undefined,
});
},
};
};CvX
Metadata
Metadata
Assignees
Labels
No labels