Skip to content

Commit 8325c37

Browse files
committed
Changes after review
1 parent 49490eb commit 8325c37

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

content/configuration/output.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ sort: 5
44
contributors:
55
- sokra
66
- skipjack
7+
- tomasAlabes
78
---
89

910
The top-level `output` key contains set of options instructing webpack on how and where it should output your bundles, assets and anything else you bundle or load with webpack.
@@ -249,7 +250,7 @@ MyLibrary.doSomething(); //if this is window
249250
```
250251

251252

252-
`libraryTarget: "commonjs"` - When your library is loaded, the return value of your entry point will be part of the exports object. As the name implies, this is used in commonjs environments:
253+
`libraryTarget: "commonjs"` - When your library is loaded, the return value of your entry point will be part of the exports object. As the name implies, this is used in CommonJS environments:
253254

254255
```javascript
255256
exports["MyLibrary"] = _entry_return_;
@@ -258,7 +259,7 @@ exports["MyLibrary"] = _entry_return_;
258259
require("MyLibrary").doSomething();
259260
```
260261

261-
`libraryTarget: "commonjs2"` - When your library is loaded, the return value of your entry point will be part of the exports object. As the name implies, this is used in commonjs environments:
262+
`libraryTarget: "commonjs2"` - When your library is loaded, the return value of your entry point will be part of the exports object. As the name implies, this is used in CommonJS environments:
262263

263264
```javascript
264265
module.exports = _entry_return_;
@@ -267,7 +268,7 @@ module.exports = _entry_return_;
267268
require("MyLibrary").doSomething();
268269
```
269270

270-
_Wondering the difference between commonjs and commonjs2? Check [this](https://github.com/webpack/webpack/issues/1114) out (they are pretty much the same)._
271+
_Wondering the difference between CommonJS and CommonJS2? Check [this](https://github.com/webpack/webpack/issues/1114) out (they are pretty much the same)._
271272

272273

273274
`libraryTarget: "commonjs-module"` - Expose it using the `module.exports` object (`output.library` is ignored), `__esModule` is defined (it's threaded as ES2015 Module in interop mode)
@@ -286,7 +287,7 @@ define([], function() {
286287
But if you download this script, first you may get a error: `define is not defined`, it’s ok!
287288
If you are distributing your library with AMD, then your users need to use RequireJS to load it.
288289

289-
Now that you have requirejs loaded, you can load your library.
290+
Now that you have RequireJS loaded, you can load your library.
290291

291292
But, `require([ _what?_ ])`?
292293

@@ -316,8 +317,10 @@ require(["MyLibrary"], function(MyLibrary){
316317
});
317318
```
318319

319-
`libraryTarget: "umd"` - This is a way for your library to work with all module definitions (and where aren't modules at all). It will work with CommonJS, amd AMD as global variable.
320-
Here to name your module you need the another property:
320+
`libraryTarget: "umd"` - This is a way for your library to work with all the module definitions (and where aren't modules at all).
321+
It will work with CommonJS, AMD and as global variable. You can check the [UMD Repository](https://github.com/umdjs/umd) to know more about it.
322+
323+
In this case, you need the another property to name your module:
321324

322325
```javascript
323326
output: {
@@ -345,6 +348,8 @@ And finally the output is:
345348

346349
Module proof library.
347350

351+
The dependencies for your library will be defined by the [`externals`](/configuration/externals/) config.
352+
348353

349354
## `output.path`
350355

0 commit comments

Comments
 (0)