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: site/docs/apis/node-api.md
+33-36
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,10 @@ shortTitle: Nodejs API
7
7
While `@wpackio/scripts` is meant to be used as a CLI tool, it does expose all
8
8
of the necessary node.js APIs to create your own CLI.
9
9
10
-
For now, the best place to check the exports is [the file](https://github.com/swashata/wp-webpack-script/blob/master/packages/scripts/src/index.ts) itself. Since we
11
-
develop in typescript and ship all `.d.ts` files, you will get IDE intellisense
Whether to include preset for `'flow'` or `'typescript'`. Leave `undefined` to ignore both.
89
+
Whether to include preset for `'flow'` or `'typescript'`. Leave `undefined` to
90
+
ignore both.
88
91
89
92
Possible values are `'flow'`, `'typescript'` or `undefined`.
90
93
91
94
## `getDefaultBabelPresetOptions`
92
95
93
-
Get default options for [@wpackio/babel-preset-base](https://github.com/swashata/wp-webpack-script/tree/master/packages/babel-preset-base) considering whether project
@@ -218,13 +217,15 @@ Whether or not to set publicPath for `file-loader`, depending on `isDev`.
218
217
219
218
## `issuer`
220
219
221
-
The API consists a family of [`webpack issuer`](https://webpack.js.org/configuration/module/#ruleissuer) utilities. Use them in conjunction with [`file-loader`](/tutorials/using-file-loader/) or
All the assets within an `$entryPoint` has internal dependency upon each other.
237
240
238
-
Let us consider the following `manifest.json` file generated by `@wpackio/scripts`.
241
+
Let us consider the following `manifest.json` file generated by
242
+
`@wpackio/scripts`.
239
243
240
244
```json
241
245
{
@@ -268,20 +272,20 @@ Here the asset `app/main.js` of `main` `entryPoint` depends on both
268
272
1.`app/vendor~main.js`.
269
273
2.`app/runtime.js`.
270
274
271
-
So if we were to `enqueue` only `app/main.js` it will not work, it need the
272
-
two scripts in the page too.
275
+
So if we were to `enqueue` only `app/main.js` it will not work, it need the two
276
+
scripts in the page too.
273
277
274
278
Similarly for the asset `app/mobile.js`, of `mobile``entryPoint`, we have
275
279
internal dependency of
276
280
277
281
1.`app/vendor~mobile.js`.
278
282
2.`app/runtime.js`.
279
283
280
-
Here `app/runtime.js` is a common dependency for both the entry-points. But
281
-
we should enqueue it only once.
284
+
Here `app/runtime.js` is a common dependency for both the entry-points. But we
285
+
should enqueue it only once.
282
286
283
-
To make sure WordPress properly enqueues the dependencies and doesn't come
284
-
up with duplicate scripts, `register` sets the scripts dependencies for you.
287
+
To make sure WordPress properly enqueues the dependencies and doesn't come up
288
+
with duplicate scripts, `register` sets the scripts dependencies for you.
285
289
286
290
So if you do something like this
287
291
@@ -302,11 +306,12 @@ wp_enqueue_script(
302
306
);
303
307
```
304
308
305
-
You can be assured that `app/vendor~main.js` and `app/runtime.js` will both
306
-
be enqueued.
309
+
You can be assured that `app/vendor~main.js` and `app/runtime.js` will both be
310
+
enqueued.
307
311
308
-
There isn't any magic behind it. We just set internal dependencies during
309
-
call to [`wp_register_(script|style)`](https://github.com/swashata/wpackio-enqueue/blob/6411c4781ed58e62f746e01d081fd1838a212edf/inc/Enqueue.php#L146).
312
+
There isn't any magic behind it. We just set internal dependencies during call
0 commit comments