next-compose-plugins
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -76,5 +76,3 @@ "use strict"; | ||
}; | ||
let config = _objectSpread({}, initialConfig); | ||
let config = (0, _phases.mergePhaseConfiguration)(phase, _objectSpread({}, initialConfig)); | ||
plugins.forEach(plugin => { | ||
@@ -81,0 +79,0 @@ const _parsePluginConfig = parsePluginConfig(plugin), |
{ | ||
"name": "next-compose-plugins", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Provides a cleaner API for enabling and configuring plugins for next.js", | ||
@@ -14,2 +14,3 @@ "main": "lib/index.js", | ||
"lint:fix": "eslint --fix src", | ||
"pretest": "npm run build", | ||
"test": "jest --coverage lib", | ||
@@ -37,15 +38,15 @@ "test:watch": "jest --watch lib", | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0-beta.46", | ||
"@babel/core": "^7.0.0-beta.46", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.46", | ||
"@babel/preset-env": "^7.0.0-beta.46", | ||
"babel-core": "^7.0.0-beta.44", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-jest": "^21.15.1", | ||
"jest": "^22.4.3", | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.4.4", | ||
"@babel/preset-env": "^7.4.4", | ||
"babel-core": "^6.26.3", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.17.2", | ||
"eslint-plugin-jest": "^22.5.1", | ||
"jest": "^24.7.1", | ||
"npm-autoinstaller": "^1.3.1", | ||
"rimraf": "^2.6.2" | ||
"rimraf": "^2.6.3" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# :bulb: next-compose-plugins [![npm version](https://img.shields.io/npm/v/next-compose-plugins.svg)](https://www.npmjs.com/package/next-compose-plugins) [![license](https://img.shields.io/github/license/cyrilwanner/next-compose-plugins.svg)](https://github.com/cyrilwanner/next-compose-plugins/blob/master/LICENSE) | ||
# :bulb: next-compose-plugins [![npm version](https://badgen.net/npm/v/next-compose-plugins)](https://www.npmjs.com/package/next-compose-plugins) [![license](https://badgen.net/github/license/cyrilwanner/next-compose-plugins)](https://github.com/cyrilwanner/next-compose-plugins/blob/master/LICENSE) [![downloads](https://badgen.net/npm/dt/next-compose-plugins)](https://www.npmjs.com/package/next-compose-plugins) | ||
@@ -71,3 +71,3 @@ Provides a cleaner API for enabling and configuring plugins for [next.js](https://github.com/zeit/next.js) because the default way next.js suggests to enable and configure plugins can get unclear and confusing when you have many plugins. | ||
const withPlugins = require('next-compose-plugins'); | ||
const { PHASE_PRODUCTION_BUILD } = require('next/constants'); | ||
const { PHASE_PRODUCTION_BUILD } = require('next-server/constants'); | ||
const sass = require('@zeit/next-sass'); | ||
@@ -92,3 +92,3 @@ | ||
You can also combine multiple phases (`[PHASE_PRODUCTION_BUILD + PHASE_PRODUCTION_SERVER]: {}`) or exclude a phase (`['!' + PHASE_PRODUCTION_BUILD]: {}` which will overwrite the config in all phases except `PRODUCTION_BUILD`). | ||
You can use all phases [next.js provides](https://github.com/zeit/next.js/blob/canary/lib/constants.js). | ||
You can use all phases [next.js provides](https://github.com/zeit/next.js/blob/canary/packages/next-server/lib/constants.ts). | ||
@@ -98,7 +98,7 @@ ##### `phases?: array` | ||
If the plugin should only be applied in specific phases, you can specify them here. | ||
You can use all phases [next.js provides](https://github.com/zeit/next.js/blob/canary/lib/constants.js). | ||
You can use all phases [next.js provides](https://github.com/zeit/next.js/blob/canary/packages/next-server/lib/constants.ts). | ||
```javascript | ||
const withPlugins = require('next-compose-plugins'); | ||
const { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } = require('next/constants'); | ||
const { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } = require('next-server/constants'); | ||
const sass = require('@zeit/next-sass'); | ||
@@ -120,3 +120,3 @@ | ||
const withPlugins = require('next-compose-plugins'); | ||
const { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } = require('next/constants'); | ||
const { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } = require('next-server/constants'); | ||
const sass = require('@zeit/next-sass'); | ||
@@ -160,2 +160,13 @@ | ||
Phases are also supported within the `nextConfiguration` object and have the same syntax as in [plugin `configuration` objects](#configuration-object). | ||
```javascript | ||
const { PHASE_DEVELOPMENT_SERVER } = require('next-server/constants'); | ||
const nextConfig = { | ||
distDir: 'build', | ||
['!' + PHASE_DEVELOPMENT_SERVER]: { | ||
assetPrefix: 'https://my.cdn.com', | ||
}, | ||
}; | ||
``` | ||
### Optional plugins | ||
@@ -169,3 +180,3 @@ | ||
const { withPlugins, optional } = require('next-compose-plugins'); | ||
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants'); | ||
const { PHASE_DEVELOPMENT_SERVER } = require('next-server/constants'); | ||
@@ -221,3 +232,3 @@ module.exports = withPlugins([ | ||
```javascript | ||
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants'); | ||
const { PHASE_DEVELOPMENT_SERVER } = require('next-server/constants'); | ||
@@ -325,3 +336,3 @@ module.exports = (nextConfig = {}) => { | ||
PHASE_EXPORT, | ||
} = require('next/constants'); | ||
} = require('next-server/constants'); | ||
@@ -328,0 +339,0 @@ // next.js configuration |
Sorry, the diff of this file is not supported yet
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
24471
404