Code Monkey home page Code Monkey logo

Comments (5)

cawabunga avatar cawabunga commented on September 24, 2024 1

Can confirm that everything is working. @morlay thank you!

from babel-plugin-pure-calls-annotation.

morlay avatar morlay commented on September 24, 2024

@cawabunga I upgrade to babel 7.15, but haven't seen this issue.

test case here: https://github.com/morlay/babel-plugin-pure-calls-annotation/blob/master/src/__tests__/index.spec.ts#L75-L77

Notice: the plugin will not process body in IIFE, which will be a hack to let people write logic with side effects.

from babel-plugin-pure-calls-annotation.

cawabunga avatar cawabunga commented on September 24, 2024

@morlay thanks for answer. I went through code, seems everything is fine. I run again, and it gave right results. However in my project it still doesn't work. I'll figure out what's going on and let you know if there is something important.

from babel-plugin-pure-calls-annotation.

cawabunga avatar cawabunga commented on September 24, 2024

I've written such test case:

{
  title: "Annotated #__PURE__ for defined add(0, 1) called in IIFE",
  src: `const add = (x, y) => x + y; export const one = (() => add(0, 1))();`,
  dest: `const add = (x, y) => x + y; export const one = /*#__PURE__*/(() => add(0, 1))();`,
},

It is pretty similar to the last case, except expression is wrapped with IIFE. I was expecting that it would pass, but it wouldn't. Do you have any suggestions?

from babel-plugin-pure-calls-annotation.

morlay avatar morlay commented on September 24, 2024

@cawabunga 0.4.2 should fix this.

here a special case to ignore annotating #__PURE__, old codes will wrong check for your case

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

Where #__PURE__ here, tools like uglify will remove all statement.

from babel-plugin-pure-calls-annotation.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.