From 5ca794d80468c702b53eba6d071fd4755d862142 Mon Sep 17 00:00:00 2001 From: Ashutosh Hathidara Date: Sat, 11 Apr 2020 01:41:24 +0530 Subject: [PATCH] Added doc for absolute import from gatsby eslint rules or other tools (#22750) * Added doc for absolute import from gatsby eslint rules or other tools * Added doc for absolute import from gatsby eslint rules or other tools * Prettier * Prettier * Added new section for importing non-webpack tools * Update docs/docs/add-custom-webpack-config.md Co-Authored-By: LB * Update docs/docs/add-custom-webpack-config.md Co-Authored-By: LB * Update docs/docs/add-custom-webpack-config.md Co-Authored-By: LB * Prettier run * Undone other changes Co-authored-by: LB --- docs/docs/add-custom-webpack-config.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/docs/add-custom-webpack-config.md b/docs/docs/add-custom-webpack-config.md index 60a40ee01668d..00c75eebc2a47 100644 --- a/docs/docs/add-custom-webpack-config.md +++ b/docs/docs/add-custom-webpack-config.md @@ -75,6 +75,19 @@ exports.onCreateWebpackConfig = ({ stage, actions }) => { You can always find more information on _resolve_ and other options in the official [Webpack docs](https://webpack.js.org/concepts/). +### Importing non-webpack tools using `yarn` + +Note that using absolute imports only applies to webpack resolutions and will not work for other tools, e.g. eslint or typescript. +But if you are using yarn, then the best practice is to set up your imports in package.json as shown below: + +```js +{ + "dependencies": { + "hooks": "link:./src/hooks", + } +} +``` + ### Modifying the Babel loader You need this if you want to do things like transpile parts of `node_modules`.