Registry / devops / flarum-webpack-config

flarum-webpack-config

JSON →
library3.0.4jsnpmunverified

A package that generates a Webpack configuration for transpiling JavaScript and TypeScript in Flarum extensions. The current stable version is 3.0.4. It requires Webpack 5 as a peer dependency and is released on an as-needed basis alongside Flarum updates. Key differentiators: it abstracts away Flarum-specific Webpack settings (e.g., Babel presets, module resolution) so extension authors don't need to write their own config. It supports ESM and CommonJS output and integrates with flarum-tsconfig for TypeScript projects.

npm install flarum-webpack-config
INSTALL
IMPORT
SIG · FLARUM-WEBPACK-CON
F
flarum-webpack-config
devopsjavascriptv3.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
var config = require('flarum-webpack-config'); module.exports = config(options);
import config from 'flarum-webpack-config';
Package is CommonJS-only; does not support ESM imports. Use require().
config (as function)
const config = require('flarum-webpack-config'); const webpackConfig = config({...});
const config = require('flarum-webpack-config').default;
No .default; the require returns the config function directly.
TypeScript usage
// Use in webpack.config.js (CommonJS) const config = require('flarum-webpack-config'); module.exports = config({...});
import config from 'flarum-webpack-config';
TS projects still use require() for this config file; the package does not export types.

Shows how to require the config function and use it in webpack.config.js with optional overrides.

var config = require('flarum-webpack-config'); module.exports = config({ // Optional: override or extend the default config // e.g., use webpack-merge to add custom rules });
Debug
Known issues
gotchaPackage does not export types; TypeScript users need @types/webpack installed separately.
fix
Install @types/webpack as dev dependency.
affects: >=1.0.0
breakingVersion 2.x dropped support for Webpack 4; only Webpack 5 is supported.
fix
Upgrade Webpack to ^5.
affects: >=2.0.0
deprecatedUsing require('flarum-webpack-config').default will return undefined in v3.
fix
Use require('flarum-webpack-config') without .default.
affects: >=3.0.0
gotchaThe config function expects an options object; passing null or undefined will break.
fix
Always pass an object, even if empty: config({}).
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'flarum-webpack-config'
Package not installed or missing from node_modules.
fix
Run 'npm install flarum-webpack-config --save-dev'.
TypeError: config is not a function
Using import default instead of require() or calling undefined.
fix
Use 'var config = require('flarum-webpack-config');' and then call config({...}).
Error: Cannot find module 'webpack'
Missing peer dependency webpack.
fix
Run 'npm install webpack@^5 --save-dev'.
Upgrade
Version history
3.0.4latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required to generate config
Agent activity
2 hits · last 30 days
node
2
Resources
flarum-webpack-config — npm install flarum-webpack-config · libregistry