Standard Webpack preset for Focus compliant projects. It exposes two functions :
configBuilder: builds a webpack configuration, by merging a default one and an optionnal custom oneserverLauncher: starts a Webpack dev server, with a webpack config and an optionnal custom server config
These functions rely on environment variables, set in process.env.
To configure this, a good option is to use better-npm-run. It will run npm script with environment variables.
DEV(defaulttrue): flag to mark the development state. Exposed globally through the variable__DEV__DEV_SERVER_HOST(default'localhost'): webpack dev server hostnameDEV_SERVER_PORT(default3000): webpack dev server portAPI_HOST(default'localhost'): API hostnameAPI_PORT(default8080): API portENTRY_FILE_PATH(default'./src'): project entry file pathOUTPUT_FILE_NAME(default'your-project-name'): project file nameOUTPUT_DIR(default'./dir'): output directoryPAGE_TITLE(default'You project landing page'): webpack dev server page titleANCHOR_CLASS(default'your-project'): class used to anchor theReactDOM.render. Exposed globally through the variable__ANCHOR_CLASS__PUBLIC_PATH(default'/'): path to the built files on the webpack dev serverGENERATE_HTML(defaulttrue): automatically generate theindex.htmlBABELIFIED_PATH(default'./src'): directory build by BabelMINIMIFY(defaultfalse): minimify the sourcesBROWSERS(defaultnull): browsers list that should be taken into account by the autoprefixer-loaderSOURCE_MAPS(default=true)Toggles source maps generation
configBuilder(optionalConfiguration) -> builtConfiguration
const configBuilder = require('webpack-focus').configBuilder;
module.exports = configBuilder();
serverLauncher(webpakConfiguration, optionalConfiguration)
const serverLauncher = require('webpack-focus').serverLauncher;
serverLauncher(webpackConfig);