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

__DEV__ Vite config define breaks @elastic/apm-rum-core. #221

Closed
phlegx opened this issue May 2, 2024 · 7 comments
Closed

__DEV__ Vite config define breaks @elastic/apm-rum-core. #221

phlegx opened this issue May 2, 2024 · 7 comments

Comments

@phlegx
Copy link

phlegx commented May 2, 2024

Hi!

Using the following code in plugins.ts breaks @elastic/apm-rum-core package:

define: {
 ...
  __DEV__: env.mode !== 'production',
},

See @elastic/apm-agent-rum-js/issues/1372

Maybe using a more package specific naming like __VITE_SSR_DEV__ could be very useful.

@briangleeson
Copy link
Contributor

briangleeson commented Jul 24, 2024

I've just encountered this problem as well with another package, resulting in this build error:

[commonjs--resolver] Unexpected keyword 'false' (55:5) in C:/Snaps/pwp/pwp-ui/node_modules/@carbon/react/es/components/ModalWrapper/ModalWrapper.js
file: node_modules/@carbon/react/es/components/ModalWrapper/ModalWrapper.js:55:5
55:   if(false) {
         ^

The false on line 55 should be __DEV__

The vite-ssr code mentions that this is a workaround for a bug in Vite v2.6.0:

// Vite 2.6.0 bug: use this

Seems like that bug was fixed in v2.8.0? vitejs/vite#5515

FYI We're curently using Vite v4.5.3

@briangleeson
Copy link
Contributor

Tested out @phlegx's suggestion by manually updating the __DEV__ references in node_modules/vite-ssr to use __VITE_SSR_DEV__ instead, and the problem is solved. Is this an acceptable solution @frandiox? I can cut a PR for this, as we need this fix

@briangleeson
Copy link
Contributor

PR opened: #222

@briangleeson
Copy link
Contributor

No response from the repo owner after pinging them in this ticket, via their personal website, and via DM on twitter. Not sure what we can do here if the owner is unavailable. The last commit that was merged was over a year ago, has this repo/project been abandoned?

@phlegx
Copy link
Author

phlegx commented Aug 13, 2024

thx @frandiox! 💪

@frandiox
Copy link
Owner

Should be released in 0.17.2, sorry for the delay!

@phlegx
Copy link
Author

phlegx commented Aug 13, 2024

Don't worry! The important thing is to keep going.

PR teleport and unhead are also important. Please take a look on it!

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