-
Notifications
You must be signed in to change notification settings - Fork 111
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
Node and window is not defined when building @carbon/charts #133
Comments
What method would it be calling to |
Please retest using just-released v3.1.5, I'm attempting to fall back to |
Here are steps to reproduce...
git clone https://github.com/nstuyvesant/carbon-charts.git
git checkout fix-pr-1540
git pull
cd packages/core
npx rollup -c You will get an error...
If you fix that error with the code I submitted for line 8...
do a
This is line 49...
The change made for 3.1.5 replaced my PR with...
but that triggers the error. I added this to the line before...
and I got an error...
I'm not sure why rollup spits out an error as I would have assumed Thoughts? |
I can certainly switch to the uglier syntax. It does seem like the runtime is wrong by not short-circuiting. Ugh. Will see if this can be cleaned better. |
Yeah - I looked at it for a while scratching my head. I locally upgraded rollup and all plugins but it didn't help. I even switched to node 18.16 - same result. |
Which means that when rollup tree-shakes this, it assumes Can you tweak your copy of dom-to-image-more to remove the argument in the first line (e.g. delete the |
This is what the rollupjs test code looks like: (function () {
'use strict';
if (typeof exports === 'object' && typeof module === 'object') {
module.exports = domtoimage; // eslint-disable-line no-undef
} else {
global.domtoimage = domtoimage;
}
// support node and browsers
const getComputedStyle = (global && global.getComputedStyle) || (window && window.getComputedStyle) || globalThis.getComputedStyle;
const atob = (global && global.atob) || (window && window.atob) || globalThis.atob;
console.log(getComputedStyle(null));
console.log(atob('ff'));
})(); |
I took out |
That's annoying at best. Rollup's assumption this is a module is at the root of the issue. Tweaks to come, thanks for testing |
Wish I could say the conversion to vite is ready... |
It does! |
Looks like you could tweak rollup to know that |
v3.1.6 released |
Thank you! I just updated it and rollup is now working! |
Use case: description, code
Similar issue to #131
Expected behavior
Checks to see if window is undefined before referencing a property.
Actual behavior (stack traces, console logs etc)
Assumes window is defined.
Library version
3.1.4
Browsers
The text was updated successfully, but these errors were encountered: