Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No strict library versions in package.json #16496

Open
1 task
Mupli opened this issue May 15, 2024 · 8 comments
Open
1 task

[Bug]: No strict library versions in package.json #16496

Mupli opened this issue May 15, 2024 · 8 comments

Comments

@Mupli
Copy link

Mupli commented May 15, 2024

馃捇

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

~$ babel --version
7.18.6 (@babel/core 7.24.5)

Cannot downgrade babel and code to 7.18.6.
I package.json there ^7.18.6 This will allow minor and patch version to be updated on install.
I suggest to have strict versioning. because for example fix in core can break a client (my case).

Reason why I want to downgrade is because babel is 100x slower than previous version and throws api.cache issue.

Configuration file name

babel.config.js

Configuration

export default (api) => {
    api.cache(true);
    return {
        ignore: ["**/public/**", /node_modules/],
        presets: [ ["@babel/preset-react", {
            "runtime": "automatic"
         }]],
       
    };
};

Current and expected behavior

Current: 7.18.6 (@babel/core 7.24.5)
Expected : 7.18.6 (@babel/core 7.18.6)

Environment

linux mint;
npm -v 9.6.7
node -v v18.17.1

Possible solution

remove ^ and have more control over dependencies.

Additional context

$ sudo npm list -g

/usr/lib
+-- @babel/cli@7.18.6
+-- @babel/core@7.18.6
+-- @babel/preset-env@7.18.6
...

But still I have :
~$ babel --version
7.18.6 (@babel/core 7.24.5)

@babel-bot
Copy link
Collaborator

Hey @Mupli! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@nicolo-ribaudo
Copy link
Member

With npm you can use overrides to change the version of any transitive dependency: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

Reason why I want to downgrade is because babel is 100x slower than previous version

Do you have a test case? It's the first time this gets reported, and I'd like to fix it.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 15, 2024

Also btw, babel/cli does not depend on babel/core, it only has a peer dependency.

@Mupli
Copy link
Author

Mupli commented May 15, 2024

@nicolo-ribaudo hi, thx for quick answer. No I don't have test case. I run it on my project.

153 files (simple esm module files without jsx) + 3 files with jsx tags

  • on 7.18.6 it was ~0.5 sec
  • on 7.24... it is 21 seconds !!

my babel config should change only 3 files with jsx and rest should be copied.

@Mupli
Copy link
Author

Mupli commented May 15, 2024

my command "babel app --out-dir _app"

@Mupli
Copy link
Author

Mupli commented May 15, 2024

With npm you can use overrides to change the version of any transitive dependency: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

Well I don't think I should use override in globally installed libs.

@Mupli
Copy link
Author

Mupli commented May 15, 2024

Also btw, babel/cli does not depend on babel/core, it only has a peer dependency.

Doesn't that mean that updated lib can bump up version of library?
Shouldn't be the way that version 1.0.0 works exactly the same as 10 years ago? (with same libraries).

@Mupli
Copy link
Author

Mupli commented May 16, 2024

I've started to use project babel cli via package.json (npm run.. babel). I could install core and cli with 7.18.6 by removing "^" from dependencies in package.json and reinstalling.

Now build takes ~1.0 sec.

You can close the issue if you want though I still don't know how to install same version for core and cli in global library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants