formik
formik copied to clipboard
npm run build output Can't resolve 'lodash-es/isPlainObject' in '/home/marcosjunior/evalu8-ui-library/node_modules/formik/dist
Bug report
Current Behavior
When I run the build of my project, after installing the Formik dependency, the build gives the following errors:
Expected behavior
I hope to be able to use the Formik dependency in my UI Library without these errors during the build
Reproducible example
git clone https://github.com/laboriosi/evalu8-ui-library.git
npm install
or yarn
npm run build
Suggested solution(s)
Currently, I don't have any clues
Additional context
The project works fine when I run my storybooks, all my abstractions works and I don't have any problem... It's just at the build that output that errors.
Your environment
Software | Version(s) |
---|---|
Formik | 2.2.9 |
React | 18.1.0 |
TypeScript | 4.6.4 |
npm | 8.4.0 |
Yarn | 1.22.17 |
Operating System | Ubuntu 20.04.4 LTS |
I already tried deleting my node_modules, install the dependency, cleaning the npm/yarn cache, using yarn instead. I also tried change my webpack config to that:
const path = require('path')
module.exports = {
entry: './src/index.ts',
mode: 'production',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
libraryTarget: 'umd',
library: 'ui-library',
},
module: {
rules: [
{
test: /\.css/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.tsx?$/,
use: ['ts-loader'],
exclude: /node_modules/,
},
],
},
resolve: {
alias: {
'~components': path.resolve(__dirname, './src/components'),
'~hocs': path.resolve(__dirname, './src/hocs'),
'~utils': path.resolve(__dirname, './src/utils'),
},
extensions: ['.tsx', '.ts'],
},
externals: {
react: 'react',
},
}
I'm looking at the Formik dependencies, and I'm seeing that don't have the @types/lodash-es. Is there any reason for this?