Can't build Project using Rollup bundler after migration to 7.1.1
Matt-Tranzact opened this issue · comments
Describe the bug
Can't build project using rollup due to following error being fired
To Reproduce
Error is happening when building project with rollup + resolve plugin:
Following error is fired:
[!] Error: Could not load C:\Project-Test\node_modules\imask\esm\imask (imported by node_modules/react-imask/esm/index.js): ENOENT: no such file or directory, open 'C:\Project-Test\node_modules\imask\esm\imask'
Error: Could not load C:\Project-Test\node_modules\imask\esm\imask (imported by node_modules/react-imask/esm/index.js): ENOENT: no such file or directory, open 'C:\Project-Test\node_modules\imask\esm\imask'
This is the rollup config being used:
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import terser from '@rollup/plugin-terser'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import del from 'rollup-plugin-delete'
import replace from '@rollup/plugin-replace'
import alias from '@rollup/plugin-alias'
import path from 'path'
import * as dotenv from 'dotenv'
const envs = dotenv.config()
export default {
input: 'src/index.ts',
output: [
{
file: 'dist/index.module.js',
format: 'esm'
}
],
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
...Object.entries(envs.parsed).reduce((prev, [key, val]) => {
prev[`process.env.${key}`] = JSON.stringify(val)
return prev
}, {}),
preventAssignment: true
}),
del({ targets: 'dist/*' }),
peerDepsExternal(),
resolve(),
commonjs(),
typescript({
tsconfig: './tsconfig.json'
})
]
}
Expected behavior
Should build project as version 7.0.1
Environment:
- Windows 11
- Bundler: Rollup
- react-imask 7.1.1
Additional context
After migration to 7.1.1, is there some config we need to add so bundlers can know how to resolve imask/esm ?
getting the same error after bumping to 7.1.1
It could be because react-imask
esm is importing imask/esm/...
(being replaced by rollup here). I don't think this is needed because the package.json in imask
specifies the module entry.
If I manually edit the files in node_modules/react-imask/esm
to just import from 'imask' wherever its importing imask/esm/...
and then run, it works for me.
It could be because
react-imask
esm is importingimask/esm/...
(being replaced by rollup here). I don't think this is needed because the package.json inimask
specifies the module entry.If I manually edit the files in
node_modules/react-imask/esm
to just import from 'imask' wherever its importingimask/esm/...
and then run, it works for me.
^^^This works for me as well.