mirror of
https://github.com/flarum/core.git
synced 2025-08-12 11:24:30 +02:00
Add useExtensions option
This commit is contained in:
@@ -9,7 +9,32 @@ This package generates a [Webpack](https://webpack.js.org) config object that wi
|
||||
```js
|
||||
var config = require('flarum-webpack-config');
|
||||
|
||||
module.exports = config();
|
||||
module.exports = config(options);
|
||||
```
|
||||
|
||||
To merge in custom Webpack config options, use [webpack-merge](https://www.npmjs.com/package/webpack-merge).
|
||||
|
||||
## Options
|
||||
|
||||
### `useExtensions`
|
||||
|
||||
`Array<string>`, defaults to `[]`.
|
||||
|
||||
An array of extensions whose modules should be made available. This is a shortcut to add [`externals`](https://webpack.js.org/configuration/externals/) configuration for extension modules. Imported extension modules will not be bundled, but will instead refer to the extension's exports included in the Flarum runtime (ie. `flarum.extensions["vendor/package"]`).
|
||||
|
||||
For example, to access the Tags extension module within your extension:
|
||||
|
||||
**forum.js**
|
||||
|
||||
```js
|
||||
import { Tag } from '@flarum/flarum-ext-tags/forum';
|
||||
```
|
||||
|
||||
**webpack.config.js**
|
||||
|
||||
```js
|
||||
module.exports = config({
|
||||
useExtensions: ['flarum/flarum-ext-tags']
|
||||
});
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user