Comments (8)
I too get an error in my webpack build after adding "lodash"
to .babelrc
. I have not figured it out yet.
webpack --config webpack.config.js --progress --profile --colors
/Users/brandon/projects/XXXXXX/babel-core/lib/transformation/file/options/option-manager.js:243
this.log.error("Invalid options type for " + alias, TypeError);
My problem was I added "lodash" to presets
instead of plugins
in .babelrc
. Works like a charm once I corrected that.
from babel-plugin-lodash.
I have, without any issue. I added this plugin to the .babelrc
config file, included lodash in my source, and presto. https://github.com/helion3/inspire-tree/tree/bundle
from babel-plugin-lodash.
I'm facing the same issue here, and I'm wondering if it has to do with babel-plugin-resolver, which I'm using.
At index.js#L59, this check in ImportDeclaration
always fails because it's getting the absolute path:
if (value.indexOf('lodash') !== -1) console.log(value);
// -> /Users/jjt/path/to/project/node_modules/lodash
// L59: This conditional always fails because it's an absolute path
if (fp || value == 'lodash') {
// ...
}
from babel-plugin-lodash.
@jjt interesting, would #15 work if we added support for something like
[require('babel-plugin-transform-es2015-template-literals'), { 'lodash-path': 'node_modules/lodash'}]
Though because your path there is absolute it would not be possible to transfer that logic between computers
Also if someone is interested in making a webpack example it'd be greatly appreciated
from babel-plugin-lodash.
I've gotten the babel plugin to work in a dummy webpack project.
I'll add a doc example soon. It's basically:
'module': {
'loaders': [{
'loader': 'babel',
'test': /\.js$/,
'exclude': /node_modules/,
'query': {
'plugins': ['lodash'],
'presets': ['es2015']
}
}]
}
In next release of babel-plugin-lodash will also allow you to pass the lodash package id so that it won't have to guess:
'query': {
'plugins': [['lodash', { 'id': 'lodash-compat' }]],
'presets': ['es2015']
}
from babel-plugin-lodash.
Nice that was originally how I was going to solve #15
from babel-plugin-lodash.
Nice that was originally how I was going to solve #15
This is also how we're able to test lodash
, lodash-es
, and lodash-compat
at once too.
from babel-plugin-lodash.
Patched with 5416a85 and 7352d96.
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:`
- `isModuleDeclaration` has been deprecated HOT 14
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.