Import files as string in Next.js
npm install --save next-raw
or
yarn add next-raw
Create a next.config.js
in your project
// next.config.js
const withRaw = require('next-raw')
module.exports = withRaw()
In your component
import txt from './my-file.txt'
export default () => <div>
<p>{txt}</p>
</div>