Gatsby: [gatsby-plugin-netlify-cms] Plugin's webpack build process overrides Gatsby's build process

Created on 25 Jan 2019  路  3Comments  路  Source: gatsbyjs/gatsby

Description

After adding gatsby-plugin-netlify-cms to gatsby project generated html files doesn't include scripts and are running without javascript. chunk-map.json file is overridden with chunks generated by plugin's webpack build and looks like this: {"cms":["/cms.js"]}.

Steps to reproduce

https://github.com/asistapl/gatsby-plugin-netlify-cms-bug

I created that repository with these steps:

  1. gatsby new gatsby-plugin-netlify-cms-bug
  2. cd gatsby-plugin-netlify-cms-bug
  3. yarn add netlify-cms gatsby-plugin-netlify-cms
  4. Added plugin to gatsby-config.js
  5. Updated all dependencies.

To see a bug follow these steps:

  1. git clone https://github.com/asistapl/gatsby-plugin-netlify-cms-bug
  2. cd gatsby-plugin-netlify-cms-bug
  3. yarn install
  4. gatsby build - It's a first build and it sometimes work at that moment
  5. Run gatsby build again - now bug should be visible, because gatsby is winning a race thanks to cache.
  6. To see a bug run gatsby serve and check if scripts are running
    or open chunk-map.json file and see that it includes only chunks generated by the plugin.

I tried to:

  1. Update all dependencies in package.json and even gatsby-cli.
  2. Move plugin at the top of array in gatsby-config.js.

It didn't fixed the problem.

Expected result

Plugin shouldn't change Gatsby's build output.

Actual result

Plugin overrode Gatsby's build output.

Environment

  System:
    OS: macOS 10.14.2
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.9.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.2.0 - /usr/local/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0.2
    Safari: 12.0.2
  npmPackages:
    gatsby: ^2.0.98 => 2.0.98 
    gatsby-image: ^2.0.28 => 2.0.28 
    gatsby-plugin-manifest: ^2.0.13 => 2.0.13 
    gatsby-plugin-netlify-cms: ^3.0.10 => 3.0.10 
    gatsby-plugin-offline: ^2.0.21 => 2.0.21 
    gatsby-plugin-react-helmet: ^3.0.5 => 3.0.5 
    gatsby-plugin-sharp: ^2.0.18 => 2.0.18 
    gatsby-source-filesystem: ^2.0.17 => 2.0.17 
    gatsby-transformer-sharp: ^2.1.12 => 2.1.12 
  npmGlobalPackages:
    gatsby-cli: 2.4.8
confirmed bug

All 3 comments

Thank you for reporting this @asistapl

We have a fix ready in a PR and we'll comment on this again once released!

@sidharthachatterjee Thank you very much! You made my day 馃帀

[email protected] and [email protected] were released with fixes - please update both

Was this page helpful?
0 / 5 - 0 ratings