Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: add strict: true to ContextModule #19327

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

colinaaa
Copy link
Contributor

Following up on #18367 (comment), we aim to enforce strict mode across all modules to eliminate the entry IIFE.

But the module.parser.javascript.overrideStrict option cannot apply to ContextModules.

What kind of change does this PR introduce?

bugfix

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?

Nothing

@@ -435,6 +435,7 @@ class ContextModule extends Module {
defaultObject: "redirect-warn"
};
this.buildInfo = {
strict: true,
Copy link
Member

Choose a reason for hiding this comment

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

We should pass the option here or infer them from something, otherwise it is a breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think most of the code in ContextModule is generated by Webpack. So it's fine to make it from non-strict to strict.

Copy link
Member

Choose a reason for hiding this comment

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

Most, but not all, so we need to use option here, to avoid broken code

module.exports = options => {
if (options.cache && options.cache.type === "filesystem") {
return [/Pack got invalid because of write to/];
}
Copy link
Member

Choose a reason for hiding this comment

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

Why it here?

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

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.