From 81ab65b95c99adfa2e701ff2158c3fdf4f45caf2 Mon Sep 17 00:00:00 2001 From: Ben Heidemann Date: Sun, 4 Apr 2021 03:01:24 +0100 Subject: [PATCH] docs: update and replace README.md section on using regular node.js imports --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 57d8b0a..06a9b18 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,18 @@ module.exports = { } ``` +You can then import the node.js [fs](http://nodejs.org/api/fs.html), +[path](http://nodejs.org/api/path.html) and [buffer](http://nodejs.org/api/buffer.html) modules as normal +and FilerWebpackPlugin will ensure that webpack will resolve references to these modules to the appropriate +filer shims. You will then be able to use these modules as normal (with the exception of the synchronous fs +methods e.g. `mkdirSync()`). + +```javascript +import fs from 'fs'; +import path from 'path'; +import { Buffer } from 'buffer'; +``` + The filer webpack plugin will, by default, shim the [fs](http://nodejs.org/api/fs.html), [path](http://nodejs.org/api/path.html) and [buffer](http://nodejs.org/api/buffer.html) modules. However, it's behaviour can be customised by passing an options object.