Gatsby: Virtual path with gatsby development

Created on 12 Aug 2020  路  6Comments  路  Source: gatsbyjs/gatsby

Description

When running "gatsby develop" after the latest MAJ, the development bundle seems to fail because of a wrong path parsing. This is blocking for deployment and build purpose.

Steps to reproduce

Just run gatsby develop.

Expected result

The dev build should works. Like this quick fix : https://github.com/gatsbyjs/gatsby/pull/25720#issuecomment-667997214

Actual result

There is the error about the build.

Screenshot 2020-08-12 at 09 51 22

Environment

System: OS: macOS 10.15.6 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.14.6 - ~/.nvm/versions/node/v12.18.3/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 84.0.4147.105 Firefox: 74.0 Safari: 13.1.2 npmPackages: gatsby: ^2.24.43 => 2.24.43 gatsby-image: ^2.4.15 => 2.4.15 gatsby-link: ^2.4.11 => 2.4.13 gatsby-plugin-alias-imports: ^1.0.5 => 1.0.5 gatsby-plugin-eslint: ^2.0.8 => 2.0.8 gatsby-plugin-manifest: ^2.2.39 => 2.4.22 gatsby-plugin-modal-routing: ^1.1.0 => 1.2.0 gatsby-plugin-offline: ^3.2.23 => 3.2.23 gatsby-plugin-react-helmet: ^3.1.21 => 3.3.10 gatsby-plugin-sass: ^2.3.4 => 2.3.12 gatsby-plugin-sharp: ^2.6.26 => 2.6.26 gatsby-plugin-sitemap: ^2.4.3 => 2.4.11 gatsby-plugin-styled-components: ^3.2.3 => 3.3.10 gatsby-plugin-svgr: ^2.0.2 => 2.0.2 gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4 gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5 gatsby-source-contentful: ^2.3.36 => 2.3.36 gatsby-source-filesystem: ^2.1.46 => 2.3.24 gatsby-transformer-plaintext: ^1.0.0 => 1.0.0 gatsby-transformer-sharp: ^2.3.13 => 2.5.12 npmGlobalPackages: gatsby-cli: 2.12.68

Reference

As asked by @pieh there is the whole discussion https://github.com/gatsbyjs/gatsby/pull/25720

Thank you in advance for your hard work !

webpacbabel bug

All 6 comments

Do you use custom eslint setup? Possibly with gatsby-plugin-eslint? If so - could you share your eslint configuration?

There is the .eslintrc and yes we use gatsby-plugin-eslint in dev purpose.

{
  "parser": "babel-eslint",
  "rules": {
    "quotes": ["error", "single", { "avoidEscape": true }],
    "indent": ["error", 2],
    "react/jsx-curly-spacing": [
      2,
      { "when": "always", "spacing": { "objectLiterals": "never" } }
    ],
    "object-curly-spacing": ["error", "always", { "objectsInObjects": false }]
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended"
    // "plugin:mdx/recommended"
  ],
  "settings": {
    "import/resolver": {
      "alias": [
        ["assets", "./src/components"],
        ["components", "./src/components"],
        ["containers", "./src/containers"],
        ["contexts", "./src/contexts"],
        ["utils", "./src/utils"]
      ]
    },
    "react": {
      "pragma": "React",
      "version": "latest"
    }
  },
  "env": {
    "browser": true,
    "jest": true,
    "node": true
  }
}

It looks like this is pretty much same problem as one described in https://github.com/gatsbyjs/gatsby/issues/26319#issuecomment-671462868, so idea of adjusting "virtual path" to include .cache for those autogenerated modules probably will fix it (as gatsby-plugin-eslint already ignores .cache).

Thanks for the eslint config - this should make it much easier for me to reproduce

Perfect, it works ! I close this one because it's already handled in the linked post ! Thank you again for your reactivity, I'm waiting for your update !

Perfect, it works !

By this - do you mean that you tried the change from PR ( https://github.com/gatsbyjs/gatsby/pull/26396 ) locally?

I did manually test my change after I reproduced the problem using gatsby-plugin-eslint and your .eslintrc config, but that was very simple reproduction case

Yes I added this code to my .eslintrc

{
  ...,
  ignorePatterns: ["sync-requires.js", "**/_this_is_virtual_fs_path_/**/*.js"]
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferMartz picture ferMartz  路  3Comments

timbrandin picture timbrandin  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments

ghost picture ghost  路  3Comments