Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplest example does not work #392

Open
d8corp opened this issue Dec 22, 2023 · 7 comments
Open

Simplest example does not work #392

d8corp opened this issue Dec 22, 2023 · 7 comments

Comments

@d8corp
Copy link

d8corp commented Dec 22, 2023

I create the simplest example with latest versions of libs and chrome. It does not change the textarea height.

Check it here:
https://stackblitz.com/edit/stackblitz-starters-3yw9em?file=src%2Findex.tsx

import { createRoot } from 'react-dom/client';
import TextareaAutosize from 'react-textarea-autosize';

const root = createRoot(document.getElementById('app'));

root.render(
  <div>
    <TextareaAutosize />
  </div>
);
@Andarist
Copy link
Owner

Stackblitz doesnt configure the browser condition here and it picked up a bundle that is meant to be loaded in server environments.

@d8corp
Copy link
Author

d8corp commented Dec 22, 2023

I updated react-textarea-autosize in my project from 6.1.0 to 8.5.3 to have ref prop and it had broken.
the 6.1.0 works on Stackblitz (https://stackblitz.com/edit/stackblitz-starters-enhi95?file=src%2Findex.tsx)

@Andarist
Copy link
Owner

What bundler do you use in your project?

@d8corp
Copy link
Author

d8corp commented Dec 25, 2023

webpack, babel-loader
7.1.2 works fine

@Andarist
Copy link
Owner

What version of webpack? is it a custom configuration or are you using it through some framework~?

@d8corp
Copy link
Author

d8corp commented Dec 26, 2023

Custom configuration, webpack 4.

@VanCoding
Copy link

@Andarist I have the same problem. Changing the "browser" property of package.json from

"browser": {
    "./dist/react-textarea-autosize.esm.js": "./dist/react-textarea-autosize.browser.esm.js"
  },

to

"browser": {
    "./dist/react-textarea-autosize.esm.js": "./dist/react-textarea-autosize.browser.esm.js",
    "./dist/react-textarea-autosize.cjs.js":"./dist/react-textarea-autosize.browser.cjs.js"
  },

seems to solve the problem. I'm still using browserify, though. Is there a reason not to include the cjs version in the "browser" object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants