0.2.1 • Published 7 years ago

babel-plugin-annotate-pure-call-in-variable-declarator v0.2.1

Weekly downloads
3
License
WTFPL
Repository
github
Last release
7 years ago

babel-plugin-annotate-pure-call-in-variable-declarator

Build Status NPM Dependencies License

Automated annotate #PURE to call expression which in variable declarator, assignment expression and arguments of call expression

Purpose

help to annotate #PURE to drop dead code in Webpack for uglyfiy and tree shaking

Will transform

export const call = (s) => {
  return "call" + s
}

export const stringA = call("a")
export const stringB = (() => call("b"))()

to

export const call = (s) => {
  return "call" + s
}

export const stringA = /*#__PURE__*/call("a")
export const stringB = /*#__PURE__*/(() => call("b"))()