File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -3243,6 +3243,25 @@ async function compileLightningCSS(
32433243 line : e . loc . line ,
32443244 column : e . loc . column - 1 , // 1-based
32453245 }
3246+ // add friendly error for https://github.com/parcel-bundler/lightningcss/issues/39
3247+ try {
3248+ const code = fs . readFileSync ( e . fileName , 'utf-8' )
3249+ const commonIeMessage =
3250+ ', which was used in the past to support old Internet Explorer versions.' +
3251+ ' This is not a valid CSS syntax and will be ignored by modern browsers. ' +
3252+ '\nWhile this is not supported by LightningCSS, you can set `css.lightningcss.errorRecovery: true` to strip these codes.'
3253+ if ( / [ \s ; { ] \* [ a - z A - Z - ] [ \w - ] + \s * : / . test ( code ) ) {
3254+ // https://stackoverflow.com/a/1667560
3255+ e . message +=
3256+ '.\nThis file contains star property hack (e.g. `*zoom`)' +
3257+ commonIeMessage
3258+ } else if ( / m i n - w i d t h : \s * 0 \\ 0 / . test ( code ) ) {
3259+ // https://stackoverflow.com/a/14585820
3260+ e . message +=
3261+ '.\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`)' +
3262+ commonIeMessage
3263+ }
3264+ } catch { }
32463265 }
32473266 throw e
32483267 }
You can’t perform that action at this time.
0 commit comments