travis-r6s / gridsome-plugin-flexsearch

Add lightning fast search to Gridsome with FlexSearch
24 stars 7 forks source link

TypeError: Object.fromEntries is not a function - after upgrading to gridsome v0.7.17 #45

Closed vootrunner closed 4 years ago

vootrunner commented 4 years ago
TypeError: Object.fromEntries is not a function
    at collectionStore.data.map.node (/home/kimery/test/my-project/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:72:26)
    at Array.map (<anonymous>)
    at getStoreCollection (/home/kimery/test/my-project/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:56:35)
    at collection (/home/kimery/test/my-project/node_modules/gridsome-plugin-flexsearch/gridsome.server.js:122:14)
    at /home/kimery/test/my-project/node_modules/gridsome-plugin-flexsearch/node_modules/p-map/index.js:57:28
vootrunner commented 4 years ago

Config:

// This is where project configuration and plugin options are located.
// Learn more: https://gridsome.org/docs/config

// Changes here require a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`

module.exports = {
  siteName: 'Gridsome',
  siteDescription: "An open-source framework to generate awesome pages",
  plugins: [
    {
      use: 'gridsome-plugin-tailwindcss',
      options: {
        tailwindConfig: './tailwind.config.js',
        purgeConfig: {
          whitelist: ['svg-inline--fa', 'table', 'table-striped', 'table-bordered', 'table-hover', 'table-sm'],
          whitelistPatterns: [/fa-$/, /blockquote$/, /code$/, /pre$/, /table$/, /table-$/, /vueperslide$/, /vueperslide-$/]
        },
        presetEnvConfig: {},
        shouldPurge: false,
        shouldImport: true,
        shouldTimeTravel: true,
        shouldPurgeUnusedKeyframes: true,
      }
    },
    {
      use: 'gridsome-source-static-meta',
      options: {
        path: 'content/site/*.json'
      }
    },
    {
      use: '@gridsome/source-filesystem',
      options: {
        typeName: 'Author',
        path: './content/author/*.md'
      }
    },
    {
      use: '@gridsome/source-filesystem',
      options: {
        typeName: 'Blog',
        path: './content/blog/**/*.md',
        refs: {
          author: 'Author',
          tags: {
            typeName: 'Tag',
            create: true
          },
          category: {
            typeName: 'Category',
            create: true
          }
        }
      }
    },
    {
      use: '@gridsome/source-filesystem',
      options: {
        typeName: 'CustomPage',
        path: './content/pages/*.md'
      }
    },
    {
      use: 'gridsome-plugin-flexsearch',
      options: {
        searchFields: ['title', 'content'],
        collections: [{
          typeName: 'Blog',
          indexName: 'Blog',
          fields: ['title', 'category', 'excerpt', 'content']
        }]
      }
    }
  ],
  transformers: {
    remark: {
      plugins: [
        'remark-autolink-headings',
        'remark-attr',
        ['gridsome-plugin-remark-prismjs-all', {
          noInlineHighlight: false,
          showLineNumbers: false,
        }],
        require('./packages/gridsome-plugin-remark-figure')
      ],

      processImages: false

    }
  },
  templates: {
    Blog: [{
      path: '/posts/:title'
    }],
    CustomPage: [{
      path: '/:title',
      component: '~/templates/CustomPage.vue'
    }],
    Category: [{
      path: '/category/:title',
      component: '~/templates/Category.vue'
    }],
    Author: [{
      path: '/author/:name',
      component: '~/templates/Author.vue'
    }],
    Tag: [{
      path: '/tags/:title',
      component: '~/templates/Tag.vue'
    }]
  },
  chainWebpack: config => {
      config.resolve.alias.set('@pageImage', '@/assets/images');
  }
}
vootrunner commented 4 years ago

I'm able to reproduce this with a fresh gridsome install using the 'gridsome-starter-liebling' theme. No changes, just install and run gridsome develop

noxify commented 4 years ago

Hi @vootrunner ,

i'm not able to reproduce the issue. Tested it with the mentioned starter ( used also a fresh install ).

Both CLI commands ( gridsome develop and gridsome build ) are working without any errors.

Here my gridsome info output:

gridsome info

  System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
  Binaries:
    Node: 13.10.1 - /usr/local/bin/node
    npm: 6.14.5 - /usr/local/bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Safari: 13.1.1
  npmPackages:
    @gridsome/source-filesystem: ^0.6.2 => 0.6.2 
    @gridsome/transformer-remark: ^0.6.0 => 0.6.0 
    gridsome: ^0.7.17 => 0.7.17 
    gridsome-plugin-flexsearch: ^1.0.1 => 1.0.1 
    gridsome-plugin-remark-prismjs-all: ^0.3.5 => 0.3.5 
    gridsome-plugin-tailwindcss: ^2.2.48 => 2.2.48 
    gridsome-source-static-meta: github:noxify/gridsome-source-static-meta#master => 1.0.1 
  npmGlobalPackages:
    @gridsome/cli: 0.3.3
travis-r6s commented 4 years ago

Hey @vootrunner - what version of Node are you using? This plugin requires at least v12.

Object.fromEntries is not available in earlier versions of Node.

vootrunner commented 4 years ago
$ nodejs -v
v10.19.0

Sorry for the false alarm. I trusted the version bundled with Ubuntu 20.04 to be a recent version.