babel-plugin-nodejs-import-images
v1.0.0 babel plugin nodejs import require images
babel-plugin-nodejs-import-images
import img from './img.jpg'
will be transformed to
const img = require('fs').readFileSync('./img.jpg')
so you can use it like this
import img from './img.png'
const app = new Koa()
app.use(function * (next) {
this.type = 'image/png'
this.body = img
})
npm i babel-plugin-nodejs-import-images
Source Code
github.com/wssgcg1213/babel-...Metadata
- MIT
- Whatever
- Ling.
- released 5/15/2016