customize-cra
Advanced tools
Comparing version 0.1.0-beta4 to 0.1.0-beta5
23
index.js
const curry = require("lodash.curry"); | ||
const flow = require("lodash.flow"); | ||
const addBundleVisualizer = () => config => { | ||
const addBundleVisualizer = (options = {}) => config => { | ||
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; | ||
config.plugins.push( | ||
new BundleAnalyzerPlugin({ | ||
analyzerMode: "static", | ||
reportFilename: "report.html" | ||
}) | ||
new BundleAnalyzerPlugin( | ||
Object.assign( | ||
{ | ||
analyzerMode: "static", | ||
reportFilename: "report.html" | ||
}, | ||
options | ||
) | ||
) | ||
); | ||
@@ -58,9 +63,3 @@ return config; | ||
const override = (...pipeline) => (config, env) => | ||
flow( | ||
...pipeline.map(f => { | ||
const curried = curry(f, 2); | ||
return curried(curry.placeholder, env); | ||
}) | ||
)(config); | ||
const override = (...plugins) => config => flow(...plugins.map(f => f || (a => a)))(config); | ||
@@ -67,0 +66,0 @@ module.exports = { |
{ | ||
"name": "customize-cra", | ||
"version": "0.1.0-beta4", | ||
"version": "0.1.0-beta5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,8 @@ # customize-cra | ||
--- | ||
To be clear, you need to use this project with `react-app-rewired`; be sure to read their docs if you never have. The code in this project, documented below, is designed to work inside of `react-app-rewired`'s `config-overrides.js` file. | ||
--- | ||
To start, this project will export methods I need for what I'm using CRA for, but PRs will of course be welcome. | ||
@@ -39,6 +45,15 @@ | ||
### addBundleVisualizer() | ||
### addBundleVisualizer(options) | ||
Adds the bundle visualizer plugin to your webpack config. Be sure to have `webpack-bundle-analyzer` installed. | ||
Adds the bundle visualizer plugin to your webpack config. Be sure to have `webpack-bundle-analyzer` installed. By default, the options passed to the plugin will be | ||
```js | ||
{ | ||
analyzerMode: "static", | ||
reportFilename: "report.html" | ||
} | ||
``` | ||
which can be overridden with the (optional) options argument. | ||
## Using the plugins | ||
@@ -45,0 +60,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5475
78
59