You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-14Lines changed: 15 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@
13
13
14
14
# expose-loader
15
15
16
-
The `expose-loader` loader allows to expose a module (in whole or in part) to global object (`self`, `window` and `global`).
16
+
The `expose-loader` loader allows to expose a module (either in whole or in part) to global object (`self`, `window` and `global`).
17
17
18
-
For further hints on compatibility issues, check out [Shimming](https://webpack.js.org/guides/shimming/)of the official docs.
18
+
For compatibility tips and examples, check out [Shimming](https://webpack.js.org/guides/shimming/)guide in the official documentation.
19
19
20
20
## Getting Started
21
21
@@ -37,7 +37,7 @@ or
37
37
pnpm add -D expose-loader
38
38
```
39
39
40
-
(If you're using WebPack 4, install `expose-loader@1` and follow the [corresponding instructions](https://v4.webpack.js.org/loaders/expose-loader/) instead.)
40
+
(If you're using webpack 4, install `expose-loader@1` and follow the [corresponding instructions](https://v4.webpack.js.org/loaders/expose-loader/) instead.)
41
41
42
42
Then you can use the `expose-loader` using two approaches.
43
43
@@ -48,7 +48,7 @@ The documentation and syntax examples can be read [here](#syntax).
48
48
49
49
> [!WARNING]
50
50
>
51
-
> `%20`is space in a query string, because you can't use spaces in URLs
51
+
> `%20`represents a `space` in a query string because spaces are not allowed in URLs.
The [`require.resolve`](https://nodejs.org/api/modules.html#modules_require_resolve_request_options) call is a Node.js function (unrelated to `require.resolve` in webpack processing).
118
-
`require.resolve`gives you the absolute path to the module (`"/.../app/node_modules/jquery/dist/jquery.js"`).
119
-
So the expose only applies to the `jquery` module. And it's only exposed when used in the bundle.
118
+
`require.resolve`that returns the absolute path of the module (`"/.../app/node_modules/jquery/dist/jquery.js"`).
119
+
So the expose only applies to the `jquery` module and it's only exposed when used in the bundle.
120
120
121
-
And run `webpack` via your preferred method.
121
+
Finally, run `webpack`using the method you normally use (e.g., via CLI or an npm script).
122
122
123
123
## Options
124
124
@@ -155,17 +155,17 @@ List of exposes.
155
155
156
156
#### `string`
157
157
158
-
Allows to use a string to describe an expose.
158
+
Allows to use a `string` to describe an expose.
159
159
160
160
##### `syntax`
161
161
162
162
The `|` or `%20` (space) allow to separate the `globalName`, `moduleLocalName` and `override` of expose.
163
163
164
164
String syntax - `[[globalName] [moduleLocalName] [override]]` or `[[globalName]|[moduleLocalName]|[override]]`, where:
165
165
166
-
-`globalName` - the name in the global object, for example `window.$` for a browser environment (**required**)
167
-
-`moduleLocalName` - the name of method/variable/etc of the module (the module must export it) (**may be omitted**)
168
-
-`override` - allows to override existing value in the global object (**may be omitted**)
166
+
-`globalName` - The name on the global object, for example `window.$` for a browser environment (**required**)
167
+
-`moduleLocalName` - The name of method/variableetc of the module (the module must export it) (**may be omitted**)
168
+
-`override` - Allows to override existing value in the global object (**may be omitted**)
169
169
170
170
If `moduleLocalName` is not specified, it exposes the entire module to the global object, otherwise it exposes only the value of `moduleLocalName`.
171
171
@@ -262,7 +262,7 @@ type moduleLocalName = string;
262
262
263
263
Default: `undefined`
264
264
265
-
The name of method/variable/etc of the module (the module must export it).
265
+
The name of method/variableetc of the module (the module must export it).
266
266
If `moduleLocalName` is specified, it exposes only the value of `moduleLocalName`.
267
267
268
268
**src/index.js**
@@ -375,7 +375,7 @@ module.exports = {
375
375
376
376
It will expose **only**`map`, `filter` and `find` (under `myNameForFind` name) methods to the global object.
377
377
378
-
In a browser these methods will be available under `windows._.map(..args)`, `windows._.filter(...args)` and `windows._.myNameForFind(...args)` methods.
378
+
In browsers, these methods will be available under `windows._.map(..args)`, `windows._.filter(...args)` and `windows._.myNameForFind(...args)` methods.
379
379
380
380
### `globalObject`
381
381
@@ -460,7 +460,8 @@ module.exports = {
460
460
461
461
## Contributing
462
462
463
-
Please take a moment to read our contributing guidelines if you haven't yet done so.
463
+
We welcome all contributions!
464
+
If you're new here, please take a moment to review our contributing guidelines before submitting issues or pull requests.
0 commit comments