forked from complexdatacollective/Fresco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
44 lines (40 loc) · 1.07 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import('./env.js');
import ChildProcess from 'node:child_process';
import pkg from './package.json' with { type: 'json' };
let commitHash = 'Unknown commit hash';
try {
commitHash = ChildProcess.execSync('git log --pretty=format:"%h" -n1')
.toString()
.trim()
} catch (error) {
// eslint-disable-next-line no-console
console.info('Error getting commit hash:', error.message ?? 'Unknown error');
}
/** @type {import("next").NextConfig} */
const config = {
output: 'standalone',
reactStrictMode: true,
experimental: {
typedRoutes: true,
webpackBuildWorker: true,
},
webpack: (config) => {
config.module.rules.push({
test: /\.(jpe?g|png|svg|gif|ico|eot|ttf|woff|woff2|mp4|pdf|webm|txt|mp3)$/,
type: 'asset/resource',
generator: {
filename: 'static/chunks/[path][name].[hash][ext]',
},
});
return config;
},
env: {
// add the package.json version and git hash to the environment
APP_VERSION: `v${pkg.version}`,
COMMIT_HASH: commitHash,
},
eslint: {
dirs: ['./'],
}
};
export default config;