customize-cra
Advanced tools
Comparing version 0.2.12 to 0.2.13
17
index.js
@@ -92,2 +92,7 @@ const flow = require("lodash.flow"); | ||
const addWebpackPlugin = plugin => config => { | ||
config.plugins.push(plugin); | ||
return config; | ||
}; | ||
const adjustWorkbox = adjust => config => { | ||
@@ -279,2 +284,12 @@ config.plugins.forEach(p => { | ||
// to be used to ignore replace packages with global variable | ||
// Useful when trying to offload libs to CDN | ||
const addWebpackExternals = (externalDeps) => config => { | ||
config.externals = { | ||
...config.externals, | ||
...externalDeps | ||
}; | ||
return config; | ||
}; | ||
const addPostcssPlugins = (plugins) => config => { | ||
@@ -321,5 +336,7 @@ const rules = config.module.rules.find(rule => Array.isArray(rule.oneOf)) | ||
addDecoratorsLegacy, | ||
addWebpackExternals, | ||
disableEsLint, | ||
addWebpackAlias, | ||
addWebpackResolve, | ||
addWebpackPlugin, | ||
adjustWorkbox, | ||
@@ -326,0 +343,0 @@ useEslintRc, |
{ | ||
"name": "customize-cra", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "repository": "arackaf/customize-cra", |
@@ -153,2 +153,19 @@ # customize-cra | ||
### addWebpackPlugin(plugin) | ||
Adds the provided plugin info into webpack's plugin array. Pass a plugin defined with `new webpack.DefinePlugin({...})` | ||
### addWebpackExternals(deps) | ||
Add external dependencies, useful when trying to offload libs to CDN. | ||
For example you can [offload](https://github.com/facebook/create-react-app/issues/2758) `react` and `react-dom` by | ||
```js | ||
addWebpackExternals({ | ||
'react': 'React', | ||
'react-dom': 'ReactDom' | ||
}) | ||
``` | ||
### addBundleVisualizer(options, behindFlag = false) | ||
@@ -256,2 +273,11 @@ | ||
> if you use TypeScript (npm init react-app my-app --typescript) with CSS Modules, you should edit `react-app-env.d.ts`. | ||
```typescript | ||
declare module '*.module.less' { | ||
const classes: { [key: string]: string }; | ||
export default classes; | ||
} | ||
``` | ||
### disableChunk | ||
@@ -353,3 +379,3 @@ | ||
Need to install `ts-loader`. | ||
Need to install `tslint-loader`. | ||
@@ -356,0 +382,0 @@ ```js |
21273
311
389
5