-
Notifications
You must be signed in to change notification settings - Fork 71
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
ReferenceError: window is not defined
in 0.32.0
#339
Comments
ReferenceError: window is not defined
in 0.32.0
This code exists in
rpt2 builds itself with itself, which is done with Rollup and Node, so I am unable to reproduce this in a Node environment.
The only I can't really pinpoint what would cause any change here, and you didn't provide a reproduction or a stacktrace / |
I unfortunately didn't snapshot it at a point in time, because I'm trying to do a larger effort around dependency upgrades. This is in a private repository anyway. :( Here's the stack trace:
The When I finish the upgrade overall, I'll take It may be related to the workspace package having |
Thanks for providing this. It looks like you're using Yarn PnP too, which is possibly related too?
Hmmm... possibly. That try/catch of So rpt2 does export an ESM version in its Related, but that's a good reminder that we should add the newer
Sounds good. A minimal repro would help quite a bit if you do hit it then. My suspicion is that it's something in your environment causing this, although I have no idea why it's different between |
I've got the same issue after upgrading from package.json{
"name": "gismeteo",
"version": "1.0.6",
"main": "lib/gismeteo.js",
"typings": "lib/gismeteo.d.ts",
"module": "lib/gismeteo.esm.js",
"files": [
"lib",
"package.json",
"README.md",
"LICENSE"
],
"license": "MIT",
"author": "sheverniskiy",
"description": "Gismeteo weather (unofficial)",
"keywords": [
"gismeteo",
"weather",
"parser",
"scraper"
],
"repository": {
"type": "git",
"url": "git+https://github.com/shevernitskiy/gismeteo.git"
},
"scripts": {
"start": "rollup -c -w",
"build": "rollup -c",
"build:watch": "rollup -c -w",
"prepare": "rollup -c",
"lint": "eslint . --ext .ts",
"test": "jest gismeteo.test.ts",
"test:coverage": "jest --coverage gismeteo.test.ts",
"playground": "jest playground.test.ts",
"release": "np patch"
},
"dependencies": {
"axios": "^0.27.2",
"cheerio": "^1.0.0-rc.11",
"is-number": "^7.0.0",
"moment": "^2.29.3",
"tslib": "~2.4.0",
"user-agents": "^1.0.1027"
},
"devDependencies": {
"@types/is-number": "^7.0.3",
"@types/jest": "~27.4",
"@types/node": "^17.0.35",
"@types/user-agents": "^1.0.2",
"@typescript-eslint/eslint-plugin": "~5.27",
"@typescript-eslint/parser": "~5.14",
"eslint": "~8.16",
"eslint-config-prettier": "~8.5",
"eslint-plugin-jest": "~26.1",
"jest": "^28.1.0",
"rollup": "^2.75.0",
"rollup-plugin-typescript2": "^0.32.0",
"ts-jest": "^28.0.3",
"typescript": "^4.7.2"
}
}
|
@shevernitskiy I see your library is open-source: https://github.com/shevernitskiy/gismeteo. I also notice that similar to @CharlesStover , both of you were updating several dependencies at once. I've upgraded to rpt2 |
Ok was able to repro the issue with both NPM and Yarn in What I also found was that That commit moves up 3 majors and in particular this issue comment stood out to me as very relevant: rollup/plugins#1005 (comment) . That should be fixed by rollup/plugins#1038 in v22.0.0, so I'll try updating that and seeing if it fixes this issue in |
Annnd yep, this exact piece of code that requires Updating to Can install via my In the meantime, @CharlesStover can you confirm that installing my yarn add --dev git+https://github.com/agilgur5/rollup-plugin-typescript2#issue-339 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
@mistyharsh yes, I've already looked into this, linked diffs of the bundle, found that it's actually not in rpt2 or That's all in the above comments made a few days ago. You can install via my branch mentioned in the above comments to workaround this while the PR is awaiting merge and release (I have merge permissions on this repo, but not release permissions on NPM). Also the bundled dependencies are a known thing, as I've linked in the above comments already, please see #80 for that. Upvotes and comments there may persuade ezolenko (this issue in and of itself may as well). |
A bugfix has been released in I've also confirmed that Thanks to everyone for submitting this issue, providing repros, etc not too long after |
What happens and why it is wrong
Environment
Versions
The command to use
envinfo
throws an error, so I'm resorting to copy-paste. All versions are latest.The error resides here:
The line saying to use
window._
throws an error becausewindow
does not exist in the Node environment.This is newly introduced in 0.32.0. Reverting to 0.31.0 fixes this.
The text was updated successfully, but these errors were encountered: