nextjs้ ็ฝฎ
$ npm install --save-dev @ranger-theme/nextjs-config
# or
$ yarn add --save-dev @ranger-theme/nextjs-config
# or
$ pnpm add --save-dev @ranger-theme/nextjs-config
const nextConfig = require('@ranger-theme/nextjs-config')
const pkg = require('./package.json')
const isProd = process.env.NODE_ENV === 'production'
/** @type {import('next').NextConfig} */
module.exports = nextConfig({
pkg,
timestamp: new Date().getTime(),
transpilePackages: [],
compiler: {
reactRemoveProperties: isProd,
removeConsole: false,
emotion: {
sourceMap: !isProd,
autoLabel: 'dev-only',
labelFormat: '[local]',
importMap: {
'@mui/system': {
styled: {
canonicalImport: ['@emotion/styled', 'default'],
styledBaseImport: ['@mui/system', 'styled']
}
},
'@mui/material/styles': {
styled: {
canonicalImport: ['@emotion/styled', 'default'],
styledBaseImport: ['@mui/material/styles', 'styled']
}
}
}
}
},
plugins: []
})
- generate svg builder config file: next.svg.js
module.exports = {
dir: 'svgs',
output: 'components',
componentName: 'SvgResource',
extension: 'ts'
}
- use commond to generate svg components:
pnpm svgbuilder
pnpm svgbuilder