@sincronia/webpack-plugin
v0.4.2-alpha.3
Published
Webpack plugin for Sincronia
Downloads
6
Keywords
Readme
@sincronia/webpack-plugin
Overview
This plugin allows you to run Webpack on your desired files. This allows you to build frontend bundles in a more modern way or even potentially bundle server side javascript files.
Installation
npm i -D @sincronia/webpack-plugin
Options
| Key | Type | Default | Description |
| ----------------- | --------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| configGenerator
| (context:Sinc.FileContext)=>webpack.Configuration
| ()=>{}
| Function that can generate a webpack configuration object. A Sinc.FileContext is passed in so that you can substitute options using the context |
| webpackConfig
| webpack.Configuration
| {}
| Same as webpack.config.js object |
Order of Configurations
- Load from closest
webpack.config.js
. - Load from
webpackConfig
insinc.config.js
and override any overlapping values. - Run
configGenerator()
fromconfigGenerator
option insinc.config.js
and override any overlapping values.
Example Usage
This example takes .wp.js
files and bundles them with webpack by generating the options with a function
//sinc.config.js
module.exports={
rules:{
match:/\.wp\.js$/,
plugins:[
name:"@sincronia/webpack-plugin",
options:{
configGenerator:(context)=>{
mode:"production",
//set name of record as the library name
library:context.name
}
}
]
}
};