Giter VIP home page Giter VIP logo

Comments (5)

sergeysova avatar sergeysova commented on May 31, 2024

You can use babel-plugin, like this:

{
  "plugins": ["effector-logger/babel-plugin"]
}

Enable plugin just for development

from logger.

slikk66 avatar slikk66 commented on May 31, 2024

hi - thanks for this note. I don't currently have a babel config file, I will create one, but can you explain just a bit? If we have this in the file, will it automatically only load it for non production usage (i.e. yarn start) ?

if I build a production version yarn build --production true are you saying that even though I have the code importing from effector-logger I shouldn't see the output in the console?

Sorry for the questions, but it just isn't clear to me (I'm new to this stuff)

thank you for the help

from logger.

zerobias avatar zerobias commented on May 31, 2024

In your case it's better to use imports from effector and enable logger in development rather than disable it in production. In babel this looks like that:

.babelrc

{
  "env": {
    "development": {
      "plugins": ["effector-logger/babel-plugin"]
    }
  }
}

And your code will looks like that:

import { createEvent, createStore } from "effector"

from logger.

slikk66 avatar slikk66 commented on May 31, 2024

I'm using craco with this project, because I am using TailwindCSS and it seems to be a requirement. It seems that .babelrc won't work as-is without further configuration. I modified my craco.config.js to look like this (without environment specification to see if I can get it working at all) and it's not working:

craco.config.js

module.exports = {
    style: {
        postcss: {
            plugins: [require("tailwindcss"), require("autoprefixer")],
        },
    },
    babel: {
        plugins: ["effector-logger/babel-plugin"],
    },
};

I get:

./src/index.tsx
Error: Cannot find module 'effector-logger/babel-plugin'

My package.json has:

        "effector": "^21.8.5",
        "effector-logger": "^0.10.0",
        "effector-react": "^21.2.1",

from logger.

AlexandrHoroshih avatar AlexandrHoroshih commented on May 31, 2024

Hello!

As of the recent '0.14.0' release, 'effector-logger' no longer includes 'effector-inspector' and integration with redux-devtools, so all related issues are gone.

With new update you can just use it conditionally

if (process.env.ENV === "development") {

 attachLogger(...)
  
}

See the release notes for details
https://github.com/effector/logger/releases/tag/v0.14.0

from logger.

Related Issues (20)

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.