Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export default {
};
```

Then run node with the `--experimental-loader` flag:
Then run node with the `--import` flag:

```sh
node --experimental-loader @node-loader/core file.js
node --import="data:text/javascript,import {register} from 'node:module'; import {pathToFileURL} from 'node:url'; register('@node-loader/core', pathToFileURL('./'))" file.js
```

Your code will now run with all loaders specified in the configuration file, merged into a single loader. When multiple loaders specify the same loader hook (such as `resolve`), they will be called sequentially until one of them returns a non-default value. The order in which they are called is the same order specified in the configuration file.
Expand All @@ -40,7 +40,7 @@ Your code will now run with all loaders specified in the configuration file, mer
By default, node-loader core looks for a configuration file called `node-loader.config.js` in the current working directory. To specify the file path to the configuration file, provide the `NODE_LOADER_CONFIG` environment variable:

```sh
NODE_LOADER_CONFIG=/Users/name/some/dir/node-loader.config.js --experimental-loader @node-loader/core file.js
NODE_LOADER_CONFIG=/Users/name/some/dir/node-loader.config.js node --import "data:text/javascript,import {register} from 'node:module'; import {pathToFileURL} from 'node:url'; register('@node-loader/core', pathToFileURL('./'))" file.js
```

Within the file, only the `loaders` property is currently respected. In the future, additional configuration options may be defined.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "lib/node-loader-core.js",
"scripts": {
"test": "node --experimental-loader ./lib/node-loader-core.js ./test/run-tests.js",
"test": "node --import=\"data:text/javascript,import {register} from 'node:module'; import {pathToFileURL} from 'node:url'; register('./lib/node-loader-core.js', pathToFileURL('./'))\" ./test/run-tests.js",
"format": "prettier --write .",
"check-format": "prettier --check .",
"lint": "eslint lib test"
Expand Down