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
Actual outcome:
Executing the script in the command line with "node script.js" produces the following error:
Object.keys(ApolloClient__default).forEach(function (key) { exports[key] = ApolloClient__default[key]; });
TypeError: Cannot assign to read only property '__esModule' of object '#'
at path\node_modules\apollo-boost\lib\bundle.cjs.js:129:74
at Array.forEach ()
at Object. (path\node_modules\apollo-boost\lib\bundle.cjs.js:129:36)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
Versions
Systems the script fails on:
System:
OS: Windows 10
Binaries:
Node: 10.15.1 - obscured path
npm: 6.9.0 - obscured path
Browsers:
Edge: 41.16299.15.0
npmPackages:
apollo-boost: ^0.3.1 => 0.3.1
I am able to still get this script to work if I enclude:
const defineProperty = Object.defineProperty;
Object.defineProperty = function (exports, name) {
if (name === '__esModule') {
exports[name] = true;
return;
}
return defineProperty.apply(this, arguments)
}
at the top of the file that imports and uses the above code.
Other notes:
changing 'use strict' to 'use loose' in bundle.cjs.js allowed the script to work without errors.
I noticed that both \apollo-boost\lib\bundle.cjs.js and \apollo-boost\lib\index.js both have the following: Object.defineProperty(exports, '__esModule', { value: true }); (lines 3 and 2)
commenting out Object.defineProperty(exports, '__esModule', { value: true }); in bundel.cjs.js also allowed the script to work without errors.
The text was updated successfully, but these errors were encountered:
Closing because I strongly suspect @dylanwulf is correct. Please reopen this issue if updating apollo-boost to the latest version does not fix the problem!
Intended outcome:
Send a mutation to a graphql endpoint with the following code:
const fetch = require('node-fetch');
const { ApolloClient, HttpLink, InMemoryCache } = require('apollo-boost');
const gql = require('graphql-tag');
const replaceItemsMutation = gql
mutation ReplacePlaylistItems($playlistItems: [PlaylistItemInput!]!) { replacePlaylistItems(playlistItems: $playlistItems) { id } }
async function createClient() {
const headers = await getAuthHeaders();
return new ApolloClient({
link: new HttpLink({
uri,
headers,
fetch
}),
cache: new InMemoryCache()
});
}
async function replacePlaylistItems(playlistItems) {
if (!client) {
client = await createClient();
}
await client.mutate({
mutation: replacePlaylistItemsMutation,
variables: { playlistItems }
})
}
module.exports = {
replacePlaylistItems
}
Actual outcome:
Executing the script in the command line with "node script.js" produces the following error:
Object.keys(ApolloClient__default).forEach(function (key) { exports[key] = ApolloClient__default[key]; });
TypeError: Cannot assign to read only property '__esModule' of object '#'
at path\node_modules\apollo-boost\lib\bundle.cjs.js:129:74
at Array.forEach ()
at Object. (path\node_modules\apollo-boost\lib\bundle.cjs.js:129:36)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
Versions
Systems the script fails on:
System:
OS: Windows 10
Binaries:
Node: 10.15.1 - obscured path
npm: 6.9.0 - obscured path
Browsers:
Edge: 41.16299.15.0
npmPackages:
apollo-boost: ^0.3.1 => 0.3.1
System:
OS: Windows 7
Binaries:
Node: 9.9.0 - obscured path
npm: 5.6.0 - obscured path
npmPackages:
apollo-boost: ^0.3.1 => 0.3.1
System:
OS: macOS 10.14.5
Binaries:
Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
npm: 5.6.0 - ~/.nvm/versions/node/v8.10.0/bin/npm
Browsers:
Chrome: 75.0.3770.80
Safari: 12.1.1
npmPackages:
apollo-boost: ^0.3.1 => 0.3.1
I am able to still get this script to work if I enclude:
const defineProperty = Object.defineProperty;
Object.defineProperty = function (exports, name) {
if (name === '__esModule') {
exports[name] = true;
return;
}
return defineProperty.apply(this, arguments)
}
at the top of the file that imports and uses the above code.
Other notes:
changing 'use strict' to 'use loose' in bundle.cjs.js allowed the script to work without errors.
I noticed that both \apollo-boost\lib\bundle.cjs.js and \apollo-boost\lib\index.js both have the following:
Object.defineProperty(exports, '__esModule', { value: true });
(lines 3 and 2)commenting out Object.defineProperty(exports, '__esModule', { value: true }); in bundel.cjs.js also allowed the script to work without errors.
The text was updated successfully, but these errors were encountered: