A loader for webpack that lets you import files as a string.
npm install --save-dev raw-loader
Use the loader either via your webpack config, CLI or inline.
##
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.txt$/,
use: 'raw-loader'
}
]
}
}
In your application
import txt from './file.txt';
webpack --module-bind 'txt=raw-loader'
In your application
import txt from 'file.txt';
In your application
import txt from 'raw-loader!./file.txt';
Juho Vepsäläinen |
Joshua Wiens |
Kees Kluskens |
Sean Larkin |