Skip to content

Commit

Permalink
docs(README): remove outdated React references (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored and joshwiens committed Nov 18, 2017
1 parent 2152a24 commit 381db4a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,39 @@ require("expose-loader?libraryName!./file.js");
// In web browsers, window.libraryName is then available.
```

This line works to expose React to the web browser to enable the Chrome React devtools:
For example, let's say you want to expose jQuery as a global called `$`:

```
require("expose-loader?React!react");
require("expose-loader?$!jquery");
```

Thus, `window.React` is then available to the Chrome React devtools extension.
Thus, `window.$` is then available in the browser console.

Alternately, you can set this in your config file:

webpack v1 usage
```
module: {
loaders: [
{ test: require.resolve("react"), loader: "expose-loader?React" }
{ test: require.resolve("jquery"), loader: "expose-loader?$" }
]
}
```
webpack v2 usage
```
module: {
rules: [{
test: require.resolve('react'),
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'React'
options: '$'
}]
}]
}
```
Also for multiple expose you can use `!` in loader string:

Let's say you also want to expose it as `window.jQuery` in addition to `window.$`.
For multiple expose you can use `!` in loader string:

webpack v1 usage
```
Expand Down

0 comments on commit 381db4a

Please sign in to comment.