Closed Tronikelis closed 1 year ago
Could you try out the version from this PR: https://github.com/Andarist/react-textarea-autosize/pull/373 ?
I got an error when trying to build it:
🎁 info building bundles!
🎁 error react-textarea-autosize [Error: Could not load X:\coding\coding\react-textarea-autosize\src\resolved-conditions\false.ts: ENOENT: no such file or directory, open 'X:\coding\coding\react-textarea-autosize\src\resolved-conditions\false.ts'] {
🎁 error react-textarea-autosize errno: -4058,
🎁 error react-textarea-autosize code: 'PLUGIN_ERROR',
🎁 error react-textarea-autosize syscall: 'open',
🎁 error react-textarea-autosize path: 'X:\\coding\\coding\\react-textarea-autosize\\src\\resolved-conditions\\false.ts',
🎁 error react-textarea-autosize pluginCode: 'ENOENT',
🎁 error react-textarea-autosize plugin: 'resolve-errors',
🎁 error react-textarea-autosize hook: 'resolveId',
🎁 error react-textarea-autosize watchFiles: [
🎁 error react-textarea-autosize 'X:\\coding\\coding\\react-textarea-autosize\\src\\index.tsx',
🎁 error react-textarea-autosize 'X:\\coding\\coding\\react-textarea-autosize\\src\\resolved-conditions\\false.ts'
🎁 error react-textarea-autosize ]
🎁 error react-textarea-autosize }
🎁 info If you want to learn more about the above error, check https://preconstruct.tools/errors
🎁 info If the error is not there and you want to learn more about it, open an issue at https://github.com/preconstruct/preconstruct/issues/new
🙈 I forgot to commit those two files. Could you try again now?
Now it builds successfully for me 🚀
Edit: tested on vite/next.js
Hey, I recently stumbled upon some weird behavior while using another library that uses your package, the library is https://github.com/nextui-org/nextui v2
I am kinda out of options, cause I am struggling to figure this out myself
I am using ts + vite + vite-plugin-ssr with default configs But got the same behavior using next.js as well
While bundling the project I got an error that
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I created an issue for this https://github.com/nextui-org/nextui/issues/1160
The gist of it is that your package gets resolved as commonjs from an esm project (vite uses esm by default either way I think) and then the cjs exports the component as
module.exports.default =
but esm treats default exports from commonjs asmodule.exports =
not asmodule.exports.default =
So when nextui-org imports your package it gets imported as
{default: ..component..}
which is not a component and it failsMore info https://github.com/nextui-org/nextui/issues/1160
I am not sure if this is because of a bad vite config, but I don't think so, because I checked your package with https://arethetypeswrong.github.io/?p=react-textarea-autosize%408.4.1 and just as I thought
node16-esm
resolves your package to cjs:Screenshot from the website
![firefox_EuObXPe0Op](https://github.com/Andarist/react-textarea-autosize/assets/56039679/518fe9bf-2fd1-4e81-a3c4-e0c09656f8d5)Thanks