facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.23k stars 626 forks source link

Load raw files as text and watch for changes #1253

Open voxlz opened 7 months ago

voxlz commented 7 months ago

Do you want to request a feature or report a bug? Feature

What is the current behavior? Using babel and metro, and a babel plugin called "babel-plugin-inline-import" I can import raw markdown as text in code. But like mentioned on their caveats, there seems to be a limitation on babel so that when the markdown file changes it does not propegate.

What is the expected behavior? There are plugins for webpack like https://github.com/elliottsj/babel-inline-import-loader that does exactly this. A similar feature for metro would be nice. Perhaps it's even possible with metro's current features, but if so it seems to be badly documented, as I can't find anything.

zybzzc commented 2 days ago

@voxlz After I use the babel-inline-import-loader, no matter how much I modify the imported file or rerun yarn start, the imported file is always the same as it was at the beginning. Have you encountered this problem? Do you have a good solution?