https://github.com/olsonpm/root-loader
https://github.com/olsonpm/root-loader
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/olsonpm/root-loader
- Owner: olsonpm
- Created: 2016-12-10T21:57:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-11T18:33:36.000Z (over 9 years ago)
- Last Synced: 2025-01-20T23:45:41.262Z (over 1 year ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# root-loader
a two-line loader that expands root paths to the configured root directory
For example the following directory structure inside `/path/to/project`
```
webpack.config.js
lib/
utils.js
client/
js/
index.js
```
and the following loader configuration
```js
{
test: /\.js$/
, exclude: /(node_modules)/
, loader: 'root'
, query: {
rootPath: __dirname
}
}
```
would expand this require statement
```js
// client/js/index.js
require('/lib/utils');
```
into
```js
// client/js/index.js
require('/path/to/project/lib/utils');
```