{"data":{"markdownRemark":{"html":"<p>If you prefer absolute imports like with GatsbyJS v2 add the following snippet to your <code class=\"language-text\">gatsby-node.js</code> file.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">const path = require(&#39;path&#39;);\n\nexports.onCreateWebpackConfig = ({ stage, actions }) =&gt; {\n  actions.setWebpackConfig({\n    resolve: {\n      modules: [path.resolve(__dirname, &quot;src&quot;), &quot;node_modules&quot;],\n    },\n  })\n}</code></pre></div>\n<p>Then you con import like so:</p>\n<p><code class=\"language-text\">import from &#39;components/MyComponent&#39;</code></p>","excerpt":"If you prefer absolute imports like with GatsbyJS v2 add the following snippet to your   file. Then you con import like so:","timeToRead":1,"frontmatter":{"date":"October 14, 2018","path":"/enable-absolute-imports-for-gatsby-v2","title":"Enable absolute imports for Gatsby v2"}},"relatedPosts":{"edges":[{"node":{"id":"88e68246-cc05-58c4-9cb0-9fa48bc65259","frontmatter":{"title":"Gatsby v2 refactoring cheat sheet","path":"/gatsby-v2-refactoring-cheat-sheet","tags":["v2","cheat sheet"]}}},{"node":{"id":"1aef1790-d364-5a28-ade8-d6196727902c","frontmatter":{"title":"Getting started with Gatsby v2","path":"/getting-started-with-gatsby-v2","tags":["v2"]}}},{"node":{"id":"c8ef7f7d-dffc-5aae-b6a0-0084762b39f0","frontmatter":{"title":"Gatsby v2","path":"/gatsby-v2","tags":["v2","beta"]}}},{"node":{"id":"43eb2d0b-dabd-5c3d-8f96-41eeffd1c003","frontmatter":{"title":"How do layouts work in Gatsby v2","path":"/how-do-layouts-work-in-gatsby-v2","tags":["v2"]}}},{"node":{"id":"53048efa-8e60-5988-8f54-73bf441a1ab2","frontmatter":{"title":"Should I rebuild my site for Gatsby v2?","path":"/should-i-rebuild-my-site-for-gatsby-v2","tags":["v2"]}}},{"node":{"id":"36c6d2e1-eff2-5062-aee4-518ccb6f4ea8","frontmatter":{"title":"StaticQuery in Gatsby v2","path":"/staticquery-in-gatsby-v2","tags":["v2"]}}},{"node":{"id":"3a89bcb1-591a-5b78-bb39-6a8488d0ce69","frontmatter":{"title":"What's new in Gatsby v2","path":"/whats-new-in-gatsby-v2","tags":["v2","beta"]}}},{"node":{"id":"9a16f7fc-6fa5-5328-816c-35542c1c38ec","frontmatter":{"title":"When should I upgrade to Gatsby v2?","path":"/when-should-i-upgrade-to-gatsby-v2","tags":["v2"]}}},{"node":{"id":"5eb98a7e-3fd2-5edf-a9f8-44f5e25da39d","frontmatter":{"title":"GatsbyJS source plugin for eventbrite.com","path":"/gatsby-source-eventbrite","tags":["v2","source","eventbrite"]}}},{"node":{"id":"374bf18f-0f86-54c8-bdb1-f051527d8210","frontmatter":{"title":"WordPress starter for GatsbyJS","path":"/gatsby-starter-wordpress","tags":["v2","starter","wordpress"]}}},{"node":{"id":"737d2352-faae-5e91-b298-07399aaf3b1c","frontmatter":{"title":"Starter project for GatsbyJS","path":"/gatsby-central-starter","tags":["v2","starter"]}}}]},"allCommentsJson":null,"allRatingsJson":{"totalCount":6,"edges":[{"node":{"id":"a86d2ca6-4f4b-5ea1-8e8a-d1e6a3e783b0","rating":"5"}},{"node":{"id":"e2a8d0d2-a71a-5f1b-979f-1bf530d56383","rating":"5"}},{"node":{"id":"f7410cc2-fab9-5c6e-b7de-72feb986a5e3","rating":"5"}},{"node":{"id":"4dea31dc-deb0-53a5-a5a6-96020140b6ee","rating":"5"}},{"node":{"id":"5dbbaa4c-3f17-553e-9adb-12bbf288c23a","rating":"5"}},{"node":{"id":"8ef8d182-d846-577e-9b9f-6dd736720364","rating":"5"}}]}},"pageContext":{"tags":["v2"]}}