teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
63 stars 9 forks source link

.txt file support in ts compiler #103

Closed KutnerUri closed 4 years ago

KutnerUri commented 4 years ago

It'd be nice to have .txt file support.

import content from './final-texts.txt';

//content is string

For example, I'm writing a test with a text snapshot. Currently I'm using export default '...', but it'd be nice to replace it with a whole txt file.

KutnerUri commented 4 years ago

I just realised this will require some support from the consuming environment, like a webpack plugin, and will damage the component isolation.

Worse case, adding a .d.ts file to the component can make ts compiler support it:

//(at final-texts.d.ts)
declare const content: string;
export default content;
qballer commented 4 years ago

Closed for not being clear