If you prefer absolute imports like with GatsbyJS v2 add the following snippet to your gatsby-node.js file.
const path = require('path');
exports.onCreateWebpackConfig = ({ stage, actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, "src"), "node_modules"],
},
})
}Then you con import like so:
import from 'components/MyComponent'
If you'd like to share this post, here are some handy links to make that easier.
Post last updated: October 14, 2018
Feedback? A point to make? Express yourself via the comment form below.
Don't forget to check the captcha. Otherwise we won't receive your comment.
Be the first to post a comment on this post