Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat next next #60

Merged
merged 2 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel"]
}
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
85 changes: 46 additions & 39 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,56 @@ const nextComposePlugins = require('next-compose-plugins')
const withPreact = require('next-plugin-preact')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
enabled: process.env.ANALYZE === 'true',
})
const {
green
} = require('chalk')
const { green } = require('chalk')

/** @type {import('next').NextConfig} */
let config = {
reactStrictMode: true,
webpack5: true,
compress: true,
generateEtags: false,
poweredByHeader: false,
trailingSlash: false,
productionBrowserSourceMaps: false,
httpAgentOptions: {
keepAlive: true
},
images: {
domains: ['src.wuh.site'],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
experimental: {
pageDataCollectionTimeout: 120000
},
webpack: (config, { dev }) => {
if (!dev) {
config.plugins.push(new CompressionWebpackPlugin({
algorithm: "gzip",
test: /\.js$|\.css$/,
threshold: 10240,
exclude: /\/node_modules/,
filename: '[base].gz',
deleteOriginalAssets: false
}))
}
config.plugins.push(new ProgressBarPlugin({
format: `build [:bar] ${green.bold(':percent')} (:elapsed s, :current / :total) :msg`,
clear: false
}))
reactStrictMode: true,
webpack5: true,
compress: true,
generateEtags: false,
poweredByHeader: false,
trailingSlash: false,
productionBrowserSourceMaps: false,
httpAgentOptions: {
keepAlive: true,
},
images: {
domains: ['src.wuh.site'],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
experimental: {
pageDataCollectionTimeout: 120000,
},
webpack: (config, { dev }) => {
if (!dev) {
config.plugins.push(
new CompressionWebpackPlugin({
algorithm: 'gzip',
test: /\.js$|\.css$/,
threshold: 10240,
exclude: /\/node_modules/,
filename: '[base].gz',
deleteOriginalAssets: false,
})
)
}
config.plugins.push(
new ProgressBarPlugin({
format: `build [:bar] ${green.bold(
':percent'
)} (:elapsed s, :current / :total) :msg`,
clear: false,
})
)

return config
}
return config
},
eslint: {
ignoreDuringBuilds: true,
},
}

module.exports = nextComposePlugins([withPreact, withBundleAnalyzer], config)
module.exports = nextComposePlugins([withPreact, withBundleAnalyzer], config)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"conventional-changelog-cli": "^2.1.1",
"dayjs": "^1.10.7",
"isomorphic-fetch": "^3.0.0",
"next": "11.1.3",
"next": "^12.0.7",
"next-seo": "^4.28.1",
"nprogress": "^0.2.0",
"preact": "^10.5.14",
Expand All @@ -34,6 +34,7 @@
"react-transition-group": "^4.4.2",
"remark": "^14.0.1",
"remark-html": "^15.0.0",
"scheduler": "^0.20.2",
"swr": "^1.0.1"
},
"devDependencies": {
Expand Down
67 changes: 51 additions & 16 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"compilerOptions": {
"baseUrl": ".",
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -15,20 +19,51 @@
"isolatedModules": true,
"jsx": "preserve",
"paths": {
"@/*": ["."],
"@/pages/*": ["pages/*"],
"@/components/*": ["components/*"],
"@/lib/*": ["lib/*"],
"@/middlewares/*": ["middlewares/*"],
"@/hooks/*": ["hooks/*"],
"@/db/*": ["db/*"],
"@/layout/*": ["layout/*"],
"@/styles/*": ["styles/*"],
"@/store/*": ["store/*"],
"@/constant/*": ["constant/*"],
"@/__utils/*": ["__utils/*"]
}
"@/*": [
"."
],
"@/pages/*": [
"pages/*"
],
"@/components/*": [
"components/*"
],
"@/lib/*": [
"lib/*"
],
"@/middlewares/*": [
"middlewares/*"
],
"@/hooks/*": [
"hooks/*"
],
"@/db/*": [
"db/*"
],
"@/layout/*": [
"layout/*"
],
"@/styles/*": [
"styles/*"
],
"@/store/*": [
"store/*"
],
"@/constant/*": [
"constant/*"
],
"@/__utils/*": [
"__utils/*"
]
},
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
Loading