34 lines
909 B
Markdown
Raw Normal View History

2021-05-20 22:09:15 +01:00
# Webpack config for Flarum JS/TS compilation
2018-02-24 16:29:19 +10:30
2018-06-16 14:34:12 +09:30
This package generates a [Webpack](https://webpack.js.org) config object that will compile JavaScript for use in Flarum.
## Usage
**webpack.config.js**
2018-02-24 16:29:19 +10:30
```js
var config = require('flarum-webpack-config');
2018-06-16 14:34:38 +09:30
module.exports = config(options);
2018-02-24 16:29:19 +10:30
```
2018-06-16 14:34:12 +09:30
To merge in custom Webpack config options, use [webpack-merge](https://www.npmjs.com/package/webpack-merge).
2018-06-16 14:34:38 +09:30
### Webpack Bundle Analyzer
You can view a visual representation of your JS Bundle by building with Webpack Bundle Analyzer.
Add another build script to your `package.json` like the one below:
```json
{
"analyze": "npx cross-env ANALYZER=true npm run build"
}
```
## Typescript
You'll need to configure a `tsconfig.json` file to ensure your IDE sets up Typescript support correctly.
For details about this, see the [`flarum/flarum-tsconfig` repository](https://github.com/flarum/flarum-tsconfig)