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

Workaround wrongly published packages #621

Closed
brillout opened this issue Feb 1, 2023 · 34 comments
Closed

Workaround wrongly published packages #621

brillout opened this issue Feb 1, 2023 · 34 comments

Comments

@brillout
Copy link
Member

brillout commented Feb 1, 2023

Description

Examples:

@brillout brillout added the enhancement ✨ New feature or request label Feb 1, 2023
@brillout
Copy link
Member Author

brillout commented Feb 6, 2023

@brillout
Copy link
Member Author

brillout commented Mar 3, 2023

vitejs/vite#11299

@brillout
Copy link
Member Author

brillout commented Mar 5, 2023

#682

@brillout
Copy link
Member Author

#700 (reply in thread)

@brillout
Copy link
Member Author

  • Move all user land to ESM in order to avoid:
    Error [ERR_REQUIRE_ESM]: require() of ES Module
    /home/rom/code/vite-plugin-ssr/node_modules/.pnpm/node-fetch@3.3.1/node_modules/node-fetch/src/index.js
    from
    /home/rom/code/vite-plugin-ssr/examples/graphql-apollo-react/server/index.js
    not supported.
    

@brillout
Copy link
Member Author

CSS imports: #791.

@brillout
Copy link
Member Author

brillout commented Apr 18, 2023

CSS imports: #791.

Maybe, instead of automatically setting ssr.noExternal: add try-catch at ssrLoadModule() and tell user to add library to ssr.noExternal.

@brillout
Copy link
Member Author

CSS imports: #791.

Maybe, instead of automatically setting ssr.noExternal: add try-catch at ssrLoadModule() and tell user to add library to ssr.noExternal.

Contribution welcome.

@brillout
Copy link
Member Author

brillout commented Apr 29, 2023

#830 (comment)

@brillout
Copy link
Member Author

brillout commented May 9, 2023

#872 (comment) (with reprod).

@brillout
Copy link
Member Author

brillout commented May 22, 2023

#901 (comment) (with reprod)

@brillout
Copy link
Member Author

brillout commented Jun 3, 2023

#934

@brillout
Copy link
Member Author

brillout commented Jun 5, 2023

Also ReferenceError: window is not defined

@brillout
Copy link
Member Author

brillout commented Jun 10, 2023

#571 (reply in thread) (with reprod)

@brillout
Copy link
Member Author

add try-catch

Actually, this also works for teaching users about hydration mismatches.

And React's infamous Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined..

@brillout
Copy link
Member Author

And React's infamous Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined..

Workaround for React's broken stack trace: #571 (reply in thread). Reprod: #571 (reply in thread).

@brillout
Copy link
Member Author

@brillout
Copy link
Member Author

Closing in favor of #984. The new plan should be a lot simpler than the current workaround.

@brillout brillout closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2023
@brillout
Copy link
Member Author

#1021

@brillout
Copy link
Member Author

brillout commented Jul 20, 2023

#1023 (reply in thread) (includes repro)

@brillout
Copy link
Member Author

Bun may come to the rescue: Bun's next release will work with Vite oven-sh/bun#250 (comment).

@brillout
Copy link
Member Author

brillout commented Jul 21, 2023

#1031 (reply in thread) (with reprod)

@brillout
Copy link
Member Author

#1071 (reply in thread) (with reprod)

@brillout
Copy link
Member Author

brillout commented Aug 19, 2023

#1084 (isn't meant to run on the server-side)

@brillout
Copy link
Member Author

brillout commented Aug 19, 2023

#1080 (no reprod)

@brillout
Copy link
Member Author

brillout commented Sep 5, 2023

List of wrongly published npm packages here.

@brillout
Copy link
Member Author

brillout commented Sep 23, 2023

vue-toast-notification ESM-CJS issue: https://github.com/brillout/vite-esm-cjs-reprod (with reprod)

Showcases that Vite inconsistently adds the library to ssr.noExternal only in dev.

@brillout
Copy link
Member Author

Vue + Map library: #1149 (reprod: https://github.com/brillout/vite-vue-cjs-esm-issue).

This one showcases an issue inside library code that the user cannot (easily) modify.

@brillout
Copy link
Member Author

Vue + Primevue: #1153 (reply in thread) (with reprod)

Showcases that Vite inconsistently adds the library to ssr.noExternal only in dev.

This one showcases an issue inside library code that the user cannot (easily) modify.

Same here.

@brillout
Copy link
Member Author

  • If a package that contains __dirname is ssr.noExternal => error is thrown at runtime.

@brillout
Copy link
Member Author

brillout commented Feb 22, 2024

Reprod: https://github.com/brillout/esm-cjs-issue_react-image-gallery

@brillout
Copy link
Member Author

Reprod: https://github.com/brillout/vike-lazyload-error-reproduction

@brillout
Copy link
Member Author

brillout commented May 13, 2024

React Native Web: #1637. This is the only one I couldn't manage to quickly fix (but maybe it's fixable by digging into the hook rule issue). I could workaround the server-side tranpsilation issues, but it then fails at a React hook issue. Reprod: #1637 (reply in thread).

This one is also interesting because it shows that using vite-plugin-cjs-interop with ssr.noExternal/ssr.optimizeDeps is far from trivial.

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

No branches or pull requests

2 participants