1.0.0 • Published 9 years ago

babel-plugin-nodejs-import-images v1.0.0

Weekly downloads
7
License
MIT
Repository
-
Last release
9 years ago

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
})
1.0.0

9 years ago