File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed
Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -60,24 +60,30 @@ function isAnalyticsIdInNextConfig() {
6060}
6161
6262function main ( ) {
63- if ( ! isSpeedInsightsInstalled ( ) ) {
64- // No @vercel /speed-insights installed, we don't need to continue
65- return ;
66- }
63+ try {
64+ if ( ! isSpeedInsightsInstalled ( ) ) {
65+ // No @vercel /speed-insights installed, we don't need to continue
66+ return ;
67+ }
6768
68- const isInConfig = isAnalyticsIdInNextConfig ( ) ;
69- const envFile = findEnvFileWithAnalyticsId ( ) ;
69+ const isInConfig = isAnalyticsIdInNextConfig ( ) ;
70+ const envFile = findEnvFileWithAnalyticsId ( ) ;
7071
71- if ( isInConfig ) {
72- console . warn (
73- '\x1b[31m' ,
74- `Please remove 'analyticsId' from your next.config.js file.` ,
75- ) ;
76- }
77- if ( envFile ) {
78- console . log (
79- '\x1b[31m' ,
80- `Please remove 'VERCEL_ANALYTICS_ID' from your ${ envFile } file.` ,
72+ if ( isInConfig ) {
73+ console . warn (
74+ '\x1b[31m' ,
75+ `Please remove 'analyticsId' from your next.config.js file.` ,
76+ ) ;
77+ }
78+ if ( envFile ) {
79+ console . log (
80+ '\x1b[31m' ,
81+ `Please remove 'VERCEL_ANALYTICS_ID' from your ${ envFile } file.` ,
82+ ) ;
83+ }
84+ } catch ( error ) {
85+ console . error (
86+ `Failed to run @vercel/speed-insights postinstall script: ${ error instanceof Error ? error . message : error } ` ,
8187 ) ;
8288 }
8389}
You can’t perform that action at this time.
0 commit comments