code-loader

1.2.0 • Public • Published

code-loader

Evaluate js(in Node) and export as source code.

Usage

app.js

import { buildInfo } from '!!code-loader!./macro'
console.log(buildInfo) // 1.0.0#184a33

macro.js

const { version } = require('./package.json')
const hash = require('child_process').execSync('git rev-parse HEAD')
const info = `${version}#${hash.slice(0, 6)}`

module.exports = `
export const buildInfo = ${JSON.stringify(info)}
`

Readme

Keywords

none

Package Sidebar

Install

npm i code-loader

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

1.42 kB

Total Files

3

Last publish

Collaborators

  • rhyzx