This repository has been archived by the owner on Jul 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f9672d
commit 9ecca7b
Showing
2 changed files
with
8 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,7 @@ | ||
# Next.js + Webpack Bundle Analyzer | ||
# The Next.js + Webpack Bundle Analyzer plugin has been moved | ||
|
||
Use `webpack-bundle-analyzer` in your Next.js project | ||
**This plugin has been moved to [@next/bundle-analyzer](https://github.com/zeit/next.js/tree/canary/packages/next-bundle-analyzer)** | ||
|
||
📢 **This repo is now deprecated and has been moved to [@next/bundle-analyzer](https://github.com/zeit/next.js/tree/canary/packages/next-bundle-analyzer)** | ||
--- | ||
|
||
## Installation | ||
|
||
``` | ||
npm install --save @zeit/next-bundle-analyzer | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn add @zeit/next-bundle-analyzer | ||
``` | ||
|
||
### Usage with environment variables | ||
|
||
Create a next.config.js (and make sure you have next-bundle-analyzer set up) | ||
|
||
```js | ||
const withBundleAnalyzer = require("@zeit/next-bundle-analyzer"); | ||
|
||
module.exports = withBundleAnalyzer({ | ||
analyzeServer: ["server", "both"].includes(process.env.BUNDLE_ANALYZE), | ||
analyzeBrowser: ["browser", "both"].includes(process.env.BUNDLE_ANALYZE), | ||
bundleAnalyzerConfig: { | ||
server: { | ||
analyzerMode: 'static', | ||
reportFilename: '../bundles/server.html' | ||
}, | ||
browser: { | ||
analyzerMode: 'static', | ||
reportFilename: '../bundles/client.html' | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
Then you can run one of these commands: | ||
|
||
```bash | ||
# Build and analyze the back end server bundle | ||
BUNDLE_ANALYZE=server yarn build | ||
|
||
# Build and analyze the front end browser bundle | ||
BUNDLE_ANALYZE=browser yarn build | ||
|
||
# Build and analyze both server and browser | ||
BUNDLE_ANALYZE=both yarn build | ||
|
||
# Build and analyze neither server nor browser | ||
yarn build | ||
``` | ||
|
||
If you choose both then two different browser windows will open. One will be for the server bundle, one for the browser bundle. | ||
The previous readme (not recommended) is available [here](https://github.com/zeit/next-plugins/tree/139d283/packages/next-bundle-analyzer). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,7 @@ | ||
# Next.js + MDX | ||
# The Next.js + MDX plugin has been moved | ||
|
||
Use [MDX](https://github.com/mdx-js/mdx) with [Next.js](https://github.com/zeit/next.js) | ||
**This plugin has been moved to [@next/mdx](https://github.com/zeit/next.js/tree/canary/packages/next-mdx)** | ||
|
||
📢 **This repo is now deprecated and has been moved to [@next/mdx](https://github.com/zeit/next.js/tree/canary/packages/next-mdx)** | ||
--- | ||
|
||
## Installation | ||
|
||
``` | ||
npm install --save @zeit/next-mdx @mdx-js/loader | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn add @zeit/next-mdx @mdx-js/loader | ||
``` | ||
|
||
## Usage | ||
|
||
Create a `next.config.js` in your project | ||
|
||
```js | ||
// next.config.js | ||
const withMDX = require('@zeit/next-mdx')() | ||
module.exports = withMDX({ | ||
/* config options here */ | ||
}) | ||
``` | ||
|
||
Optionally you can provide [MDX options](https://github.com/mdx-js/mdx#options): | ||
|
||
```js | ||
// next.config.js | ||
const withMDX = require('@zeit/next-mdx')({ | ||
options: { | ||
mdPlugins: [ | ||
|
||
], | ||
hastPlugins: [ | ||
|
||
] | ||
} | ||
}) | ||
module.exports = withMDX({ | ||
/* config options here */ | ||
}) | ||
``` | ||
|
||
Optionally you can add your custom Next.js configuration as parameter | ||
|
||
```js | ||
// next.config.js | ||
const withMDX = require('@zeit/next-mdx')() | ||
module.exports = withMDX({ | ||
webpack(config, options) { | ||
return config | ||
} | ||
}) | ||
``` | ||
|
||
Optionally you can match other file extensions for MDX compilation, by default only `.mdx` is supported | ||
|
||
```js | ||
// next.config.js | ||
const withMDX = require('@zeit/next-mdx')({ | ||
extension: /\.(md|mdx)$/ | ||
}) | ||
module.exports = withMDX({ | ||
/* config options here */ | ||
}) | ||
``` | ||
|
||
## Top level .mdx pages | ||
|
||
Define the `pagesExtensions` option to have Next.js handle `.mdx` files in the `pages` directory as pages: | ||
|
||
```js | ||
// next.config.js | ||
const withMDX = require('@zeit/next-mdx')({ | ||
extension: /\.mdx?$/ | ||
}) | ||
module.exports = withMDX({ | ||
pageExtensions: ['js', 'jsx', 'mdx'] | ||
}) | ||
``` | ||
The previous readme (not recommended) is available [here](https://github.com/zeit/next-plugins/tree/139d283/packages/next-mdx). |