babel-plugin-nodejs-import-images

v1.0.0
babel plugin for nodejs to import or require an image
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

Metadata

  • MIT
  • Whatever
  • Ling.
  • released 5/15/2016

Downloads

Maintainers