Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Use internal node globals impl #93

Merged
merged 3 commits into from
Oct 5, 2020
Merged

Use internal node globals impl #93

merged 3 commits into from
Oct 5, 2020

Conversation

mraerino
Copy link
Member

@mraerino mraerino commented Oct 5, 2020

Which problem is this pull request solving?

I ran into issues with the globals plugin being present.
The plugin is unmaintained and it would need this PR to work properly on es2020 code: calvinmetcalf/rollup-plugin-node-globals#25

List other issues or pull requests related to this problem

Addition to #88

Describe the solution you've chosen

I decided to roll our own implementation based on the rollup inject plugin.
This is a very small implementation which i don't expect to change a lot in the future.

Describe alternatives you've considered

We could publish & maintain our own plugin, but this seemed like the easier solution. We can always extract it.

Checklist

  • The status checks are successful (continuous integration). Those can be seen below.

@mraerino mraerino added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 5, 2020
@mraerino mraerino requested a review from ehmicky October 5, 2020 17:29
@mraerino mraerino self-assigned this Oct 5, 2020
@mraerino mraerino mentioned this pull request Oct 5, 2020
@ehmicky
Copy link
Contributor

ehmicky commented Oct 5, 2020

Should we put this in a different repository?
Forking the initial repository might help us get contributors to that logic. It would allow us to keep the existing tests as well.

@mraerino
Copy link
Member Author

mraerino commented Oct 5, 2020

@ehmicky feel free to put this in its own repo. i don't have the bandwidth right now.

@mraerino mraerino mentioned this pull request Oct 5, 2020
1 task
@@ -6,7 +6,7 @@
"scripts": {
"test": "npm run format && npm run test:dev",
"format": "run-s format:*",
"format:lint": "eslint --ignore-path .gitignore --fix --cache --format=codeframe --max-warnings=0 \"src/**/*.js\"",
"format:lint": "eslint --ignore-path .eslintignore --fix --cache --format=codeframe --max-warnings=0 \"src/**/*.js\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the reason to change this would be not to lint the new files in src/node-compat/assets, is this correct?
If so, I think fixing the linting errors in those files should be the fix instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those files are going to be injected into the user's bundle.
the lint errors are about the parser that eslint uses, which does not like es modules. so no chance to fix it.

see https://github.com/netlify/netlify-plugin-edge-handlers/runs/1210596968#step:5:32

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix .eslintrc.json instead to allow linting both ES modules and CommonJS, e.g. using overrides.

Copy link
Contributor

@calavera calavera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move forward with this. Maintaining a new open source project is not in scope right now.

@mraerino mraerino merged commit e3aa8bb into master Oct 5, 2020
@mraerino mraerino deleted the fix/node-compat-plugins branch October 5, 2020 18:30
@mraerino mraerino mentioned this pull request Oct 5, 2020
1 task
@ehmicky
Copy link
Contributor

ehmicky commented Oct 5, 2020

To be more precise about what I meant: my intention is to decrease our need to maintain this, not increase it. By using a fork, we could benefit in the future if the upstream issue got eventually fixed. Also, we would benefit from the unit tests. Finally, we could get contributions from the other users who seemed to experience the upstream issue as well.

We will still need to maintain this code, regardless of whether the logic is in this repository or another.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants