Skip to content

Commit e77eff4

Browse files
committed
Convert example to mjs syntax
Fixes mui#88
1 parent 4914569 commit e77eff4

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

apps/pigment-css-next-app/next.config.js apps/pigment-css-next-app/next.config.mjs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* eslint-env node */
2-
// eslint-ignore-next-line import/no-unresolved
3-
const { withPigment } = require('@pigment-css/nextjs-plugin');
4-
const { experimental_extendTheme: extendTheme } = require('@mui/material/styles');
1+
import { withPigment } from '@pigment-css/nextjs-plugin';
2+
import { experimental_extendTheme as extendTheme } from '@mui/material';
53

64
/**
75
* @typedef {import('@pigment-css/nextjs-plugin').PigmentOptions} PigmentOptions
@@ -121,4 +119,4 @@ const nextConfig = {
121119
pigment: pigmentOptions,
122120
};
123121

124-
module.exports = withPigment(nextConfig);
122+
export default withPigment(nextConfig);

apps/pigment-css-next-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@app/next-app",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"scripts": {
67
"dev": "next dev",
78
"build": "next build",

examples/pigment-css-nextjs-ts/next.config.js examples/pigment-css-nextjs-ts/next.config.mjs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { withPigment, extendTheme } = require('@pigment-css/nextjs-plugin');
1+
import { withPigment, extendTheme } from '@pigment-css/nextjs-plugin';
22

33
// To learn more about theming, visit https://github.com/mui/pigment-css/blob/master/README.md#theming
44
const theme = extendTheme({
@@ -22,7 +22,11 @@ const theme = extendTheme({
2222
},
2323
});
2424

25-
/** @type {import('next').NextConfig} */
26-
const nextConfig = {};
25+
/** @type {import('@pigment-css/nextjs-plugin').WithPigmentOptions} */
26+
const nextConfig = {
27+
pigment: {
28+
theme,
29+
},
30+
};
2731

28-
module.exports = withPigment(nextConfig, { theme });
32+
module.exports = withPigment(nextConfig);

0 commit comments

Comments
 (0)