Comments (14)
The workaround for this issue (until it's fixed in babel-plugin-lodash
) , you have to do the following modification in you babel.config.js
file:
/**
* This is override for https://github.com/lodash/babel-plugin-lodash/issues/259.
* babel-plugin-lodash is using deprecated babel API, which causes generation of many
* console.trace calls.
*/
const consoleTrace = console.trace.bind(console);
console.trace = (message, ...optionalParams) => {
if (
typeof message === 'string' &&
message.startsWith('`isModuleDeclaration` has been deprecated')
) {
return undefined; // noop
}
return consoleTrace(message, ...optionalParams);
};
module.exports = {
...babel-config...
}
from babel-plugin-lodash.
or if you use yarn, in package.json:
{
// [...]
"resolutions": {
"babel-plugin-lodash/@babel/types": "~7.20.0"
}
}
EDIT: if you use NPM use this instead on your package.json (I guess, according to the docs)
{
// [...]
"overrides": {
"babel-plugin-lodash": {
"@babel/types": "~7.20.0"
}
}
}
EDIT2: Be careful with this solution this will lock you forever on an old @babel/types version, right now its fine as we wait for babel/babel#15448 be released and we're a single minor behind, but don't rely on this forever, there might be security/performance improvements on babel (unless when remove the deprecated method outright then locking will be the only option), the real solution would be this project updating the deprecated reference, both mine and @char0n's solutions are palliatives. Stay on top of this issue to either replace this (seemly abandoned) library, or get a new version of this that doesn't need the version locking or warning clobbering
from babel-plugin-lodash.
or if you use yarn, in package.json:
{ // [...] "resolutions": { "babel-plugin-lodash/@babel/types": "~7.20.0" } }EDIT: if you use NPM use this instead on your package.json (I guess, according to the docs)
{ // [...] "overrides": { "babel-plugin-lodash": { "@babel/types": "~7.20.0" } } }
It works fine with npm
from babel-plugin-lodash.
I'd also love to see an update - the warning is harmless (so far, dunno when the deprecated object gets removed for good) but nonetheless annoying.
from babel-plugin-lodash.
This plugin looks unmaintained. Can anyone publish a fork with fix?
UPD: @sigmacomputing/babel-plugin-lodash
from babel-plugin-lodash.
If you are using pnpm, you can use this instead
"pnpm": {
"overrides": {
"babel-plugin-lodash>@babel/types": "~7.20.0"
}
}
from babel-plugin-lodash.
I'm using [email protected]
that looks to have [email protected]
as a dependency package and I'm getting this issue as a warning when I run npm run develop
. I've attempted to update the package.json
file as mentioned previously, but this hasn't worked.
Is there an expected fix for this? Looks like a PR is open but has not been approved/merged: #261
from babel-plugin-lodash.
Forking is the worst option, since it doesn't solve the issue for the ecosystem that relies on the plugin (e.g. GatsbyJS). I think we should as much as possible try to draw the attention of maintainers here. There seems to be an easy fix for the issue.
@jdalton @mathiasbynens @veksen any thoughts?
from babel-plugin-lodash.
Note the warning in #259 (comment)
Itβs best to just set this in your
package.json
deps{ "devDependencies": { "@babel/core": "~7.20.0", } }update the dep later
I found just installing @babel/types to the latest 7.20 release silenced this message (I am tied to node v14 for a previous product release):
{
"devDependencies": {
"@babel/types": "7.20.7"
}
}
I am able to use the latest @babel/core
with this installed (time of writing 7.22.15).
from babel-plugin-lodash.
me too , what can i do to fix it
from babel-plugin-lodash.
Same here
from babel-plugin-lodash.
me too
from babel-plugin-lodash.
Yep npm overrides
is a good solution as well, but be sure to be using npm >= 8.3.0
. Earlier versions of npm don't support overrides
.
from babel-plugin-lodash.
Note the warning in #259 (comment)
Itβs best to just set this in your package.json
deps
{
"devDependencies": {
"@babel/core": "~7.20.0",
}
}
update the dep later
from babel-plugin-lodash.
Related Issues (20)
- Babel 7 support HOT 2
- Issues while using with Babel 7 and Typescript plugin HOT 4
- Error: Couldn't find preset "@babel/env" relative to directory HOT 1
- Bundle size not reduced when I make a production build HOT 1
- Lazy evaluation not working for fp.flow HOT 2
- cccccckiekunkdevvibtrjecnjlngvkhvhdvdbkgcgbg
- 'unionBy' do not accept property name as iteratee HOT 3
- Plugin adds weight to project HOT 3
- Lodash is set to undefined in build if its loaded onto a local 'this' HOT 4
- Bundle contains many lodash functions HOT 5
- tips
- The 'react-router-dom' method `useLocation` is not a known module.
- lodash.min.js is not removed from the bundle HOT 2
- Do you have plan to support vitejs? HOT 1
- Import with extensions
- lodash and pnpm
- Is this plugin still relevant? HOT 4
- Error: "Cannot read property 'has' of undefined" after glob update v7.2.0 to v7.2.2
- use `module:`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-lodash.