- Added a webpack configuration to utilize terser-webpack-plugin for minifying JavaScript files in production builds, ensuring no comments are included in the output.
41 lines
1019 B
TypeScript
41 lines
1019 B
TypeScript
import type { NextConfig } from 'next'
|
|
import path from 'path'
|
|
|
|
const nextConfig: NextConfig = {
|
|
/* config options here */
|
|
sassOptions: {
|
|
includePaths: [path.join(__dirname, './src/styles')],
|
|
},
|
|
serverExternalPackages: ['@react-pdf/renderer'],
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/api/user/login',
|
|
destination: `${process.env.NEXT_PUBLIC_QSP_API_URL}/api/user/login`,
|
|
},
|
|
// {
|
|
// source: '/api/:path*',
|
|
// destination: `${process.env.NEXT_PUBLIC_API_URL}/api/:path*`,
|
|
// },
|
|
]
|
|
},
|
|
webpack: (config, { dev, isServer }) => {
|
|
if (!dev && !isServer) {
|
|
config.optimization.minimizer = config.optimization.minimizer || []
|
|
config.optimization.minimizer.push(
|
|
new (require('terser-webpack-plugin'))({
|
|
terserOptions: {
|
|
format: {
|
|
comments: false,
|
|
},
|
|
},
|
|
extractComments: false,
|
|
}),
|
|
)
|
|
}
|
|
return config
|
|
},
|
|
}
|
|
|
|
export default nextConfig
|