Skip to content

Commit

Permalink
Updated code transpilation for Next.js 13.1 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou Fang committed Feb 1, 2023
1 parent a35220e commit 970c262
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ import 'echarts/lib/component/title';

For **Next.js** user, code transpilation is needed.

For Next.js 13.1 or higher, as all `next-transpile-modules` features are natively built-in and the package has been deprecated, so please add `transpilePackages: ['echarts', 'zrender']` into `nextConfig` object:
```js
// next.config.js
/** @type {import('next').NextConfig} */

const nextConfig = {
// ...existing properties,
transpilePackages: ['echarts', 'zrender'],
}

module.exports = nextConfig
```

For previous versions:

```js
// next.config.js
const withTM = require("next-transpile-modules")(["echarts", "zrender"]);
Expand Down

0 comments on commit 970c262

Please sign in to comment.