@retailmenot/roux-resolver-webpack-plugin
Version:
Webpack resolver plugin for resolving entrypoints within a roux pantry.
41 lines (29 loc) • 1.24 kB
Markdown
# /roux-resolver-webpack-plugin
Webpack resolver plugin for resolving entrypoints within a
roux pantry.
[](https://travis-ci.org/RetailMeNotSandbox/roux-resolver-webpack-plugin)
## Installation
```sh
npm install /roux-resolver-webpack-plugin
```
## Usage
Add the following to your webpack config.
```
var RouxResolverWebpackPlugin = require( '/roux-resolver-webpack-plugin' );
{
// rest of webpack config
plugins: [
new webpack.ResolverPlugin( [
new RouxResolverWebpackPlugin()
] )
]
}
```
This should enable you to `require` files within roux pantries using their ingredient name. e.g. `require('/pantry/path/to/ingredient')` will get you the JS entrypoint for the ingredient named by
`/pantry/path/to/ingredient`.
You can add a query string to your require statements to resolve filetypes other than the js entrypoint. e.g.
`require('/pantry/path/to/ingredient?entry=sass')` will get you the
scss entrypoint for the ingredient named by
`/pantry/path/to/ingredient`.
## Tests
Run unit tests with `npm run test`