From b064689cc74b3827c59bc18aedb59f7b42caffdc Mon Sep 17 00:00:00 2001 From: Matthew Haines-Young Date: Fri, 2 Jun 2023 10:39:27 +0100 Subject: [PATCH] Update CONTRIBUTING.md Some additional information on using npm link. --- CONTRIBUTING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05c3967..0297787 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,6 +44,25 @@ When you're done, you can unlink the package by running the following: npm unlink @humanmade/block-editor-components ``` +**Note on usage with `@humanmade/webpack-helpers`:** You may hit eslint errors trying to build your assets when linked to a local copy of this. As a workaround, you need to restrict eslint to the current project directory when configuring your webpack build. Do this by filtering the loader options. + +``` +const path = require( 'node:path' ); + +presets.production( { + // ... +}, { + filterLoaders: ( loader, loaderType ) => { + // Handle symlinked node_modules. + if ( loaderType === 'eslint' ) { + loader.include = path.dirname( path.resolve( __dirname ) ); + } + + return loader; + } +} ); +``` + ### Automatic Build Whilst developing, it is useful have Webpack watch for changes and rebuild the distributed files automatically.