You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI, I use this Preact WMR plugin to work around this problem:
config.plugins.push({name: 'TypeScript 4.5 type modifier on imported names removal plugin',enforce: 'pre',transform(code,id){if(!/\.tsx?$/.test(id))return;// TODO: is this really necessary in WMR's latest version?if(id[0]==='\0'||id[0]==='\b')return;if(config.mode==='build'||config.mode==='start'){constre=/^import(.*)({.+})\s*from\s*['|"](.+)['|"]/gm;return{code: code.replace(re,(match,$1,$2,$3)=>{if(!$2.includes('type ')){returnmatch;// preserve as-is}return`import${$1}${$2.replace(/type /g,'')} from '${$3}'`;}),map: null,};}},});
Describe the bug
TypeScript 4.5
type
modifiers on imported names are not supported.https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#type-on-import-names
To Reproduce
For example, this works:
...but this breaks:
Expected behavior
Preact WMR should support all the tasty goodness of TypeScript syntactic sugar :)
Bug occurs with:
wmr
orwmr start
(development)wmr build
(production)The text was updated successfully, but these errors were encountered: