1. babel-plugin-pure-calls-annotation
[![test](https://img.shields.io/github/workflow/status/morlay/babel-plugin-pure-calls-annotation/test?style=flat-square)](https://github.com/morlay/babel-plugin-pure-calls-annotation/actions/workflows/test.yml) [![codecov](https://img.shields.io/codecov/c
babel-plugin-pure-calls-annotation
Package: babel-plugin-pure-calls-annotation
Created by: morlay
Last modified: Mon, 11 Apr 2022 16:41:05 GMT
Version: 0.4.2
License: WTFPL
Downloads: 1,419
Repository: https://github.com/morlay/babel-plugin-pure-calls-annotation

Install

npm install babel-plugin-pure-calls-annotation
yarn add babel-plugin-pure-calls-annotation

babel-plugin-pure-calls-annotation

test
codecov
npm
dep

Automated annotate /*#__PURE__*/ to call expression which in variable declarator,
assignment expression, arguments of call expression and other expressions as values

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"))()

Notice:

code like below will not be pure call

 const a = setInterval(() => {
    console.log(a)
}, 1000)

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin