UNPKG

react-viewport-utils

Version:

Utility components for working with the viewport in react

14 lines (11 loc) 495 B
const { Transformer } = require('@parcel/plugin'); const pkg = require('../../package.json'); module.exports.default = new Transformer({ async transform({ asset }) { const code = await asset.getCode(); // TODO consider adding a source map. Currently, we put the variable length to the exact same size to not make the code jump, but this is a bit odd and error prone... const result = code.replace(/_VERS_/gm, pkg.version); asset.setCode(result); return [asset]; }, });