babel-plugin-nodejs-import-images

1.0.0 • Public • Published

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

/babel-plugin-nodejs-import-images/

    Package Sidebar

    Install

    npm i babel-plugin-nodejs-import-images

    Weekly Downloads

    6

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • zeroling