Closed SahilMaharaj closed 4 years ago
My gridsome.config.js
module.exports = {
siteName: 'Gridsome',
plugins: [
{
use: '@gridsome/vue-remark',
options: {
typeName: 'Cities', // Required
baseDir: './cities', // Where .md files are located
pathPrefix: '/cities', // Add route prefix. Optional
template: './src/templates/Cities.vue', // Optional
}
},
{
use: '@gridsome/vue-remark',
options: {
typeName: 'Organisations', // Required
baseDir: './organisations', // Where .md files are located
refs: {
locations: {
typeName: 'Locations',
create: true
}
},
pathPrefix: '/organisations', // Add route prefix. Optional
template: './src/templates/Organisations.vue', // Optional
}
},
{
use: 'gridsome-plugin-flexsearch',
options: {
searchFields: ['title', 'desc'],
collections: [
{
typeName: 'Cities',
indexName: 'Cities',
fields: ['title', 'desc']
},
{
typeName: 'Organisations',
indexName: 'Organisations',
fields: ['title', 'desc']
}
]
}
}
]
}
This plugin requires at least Node version 12 - if you are using a version below that, then Object.fromEntries
will be undefined.
Could you try upgrading Node, and see if that works?
Sorry, just saw you said it was showing that on deploy - you will need to set the node version in the build environment, for example adding a NODE_VERSION
env on Netlify.
That did the trick, thanks mate!
Hi there,
All works fine on my local but when deploying I get the following:
TypeError: Object.fromEntries is not a function at collectionStore.data.map.node (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:72:26) at Array.map ()
at getStoreCollection (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:56:35)
at collection (/opt/build/repo/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:122:14)
at /opt/build/repo/node_modules/gridsome-plugin-flexsearch/node_modules/p-map/index.js:57:28
Any help would be much appreciated :)