Skip to content

add options to warn on using Node.js features #14212

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

Merged
merged 1 commit into from
Sep 14, 2021
Merged

add options to warn on using Node.js features #14212

merged 1 commit into from
Sep 14, 2021

Conversation

vankop
Copy link
Member

@vankop vankop commented Sep 11, 2021

What kind of change does this PR introduce?

fixes #14210 #14229

Did you add tests for your changes?

yes

Does this PR introduce a breaking change?

no

What needs to be documented once your changes are merged?

new experiment futureDefaults that applies defaults of next major version and add warnings in problematic places

add options:
node.global=warn - warns on global usage
node.__dirname="warn-mock" - warns on __dirname usage
node.__filename="warn-mock" - warns on __filename usage

@webpack-bot
Copy link
Contributor

webpack-bot commented Sep 11, 2021

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@vankop vankop changed the title set global to undefined for target web add warning on global usage for browser target Sep 11, 2021
@vankop vankop changed the title add warning on global usage for browser target add warning on"global" usage for browser target Sep 11, 2021
@webpack-bot
Copy link
Contributor

@vankop Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@sokra Please review the new changes.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

I think make sense to add test there we use global = 1 and const global = 1, i.e. we are free these variables to usage

@vankop vankop changed the title add warning on"global" usage for browser target add options to warn on using Node.js features Sep 14, 2021
futureDefaults applies next major defaults
adds node.global=warn
node.__filename=warn-mock
node.__dirname=warn-mock
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

For Commonhs and ECMA modules for web target we output only warnings?

@webpack-bot
Copy link
Contributor

@vankop The most important CI builds failed. This way your PR can't be merged.

Please take a look at the CI results from azure (0 errors / 0 warnings) and appveyor (failure) and fix these issues.

@sokra sokra merged commit 562f17a into main Sep 14, 2021
@sokra sokra deleted the fix-14210 branch September 14, 2021 12:03
@sokra
Copy link
Member

sokra commented Sep 14, 2021

Thanks

@webpack-bot
Copy link
Contributor

I've created an issue to document this in webpack/webpack.js.org.

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

Successfully merging this pull request may close these issues.

global is defined for the browser
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy