Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable ProvidePlugin for javascript/esm (fixes #7032) #8250

Merged
merged 3 commits into from Nov 5, 2018

Conversation

aladdin-add
Copy link
Contributor

@aladdin-add aladdin-add commented Oct 22, 2018

#7032

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?
updated a test case.

Does this PR introduce a breaking change?
not sure, I guess no. 馃槃

What needs to be documented once your changes are merged?

Copy link
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

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

add a test case

.tap("ProvidePlugin", handler);

// Disable ProvidePlugin for javascript/esm, see https://github.com/webpack/webpack/issues/7032
// normalModuleFactory.hooks.parser
Copy link
Member

Choose a reason for hiding this comment

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

remove the commented code, leave only a note why it's not enabled

@webpack-bot
Copy link
Contributor

webpack-bot commented Oct 22, 2018

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

@sokra sokra closed this Oct 23, 2018
@sokra sokra reopened this Oct 23, 2018
Copy link
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

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

Tests missing

@aladdin-add aladdin-add changed the title fix: disable ProvidePlugin for javascript/esm (fixes #7032) wip: fix: disable ProvidePlugin for javascript/esm (fixes #7032) Oct 24, 2018
@webpack-bot
Copy link
Contributor

@aladdin-add Thanks for your update.

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

@sokra Please review the new changes.

@aladdin-add
Copy link
Contributor Author

@sokra I updated the test case in test/configCases/plugins/provide-plugin, added a '.mjs' in it.
please let me know if need something more.

@aladdin-add aladdin-add changed the title wip: fix: disable ProvidePlugin for javascript/esm (fixes #7032) fix: disable ProvidePlugin for javascript/esm (fixes #7032) Oct 28, 2018
@@ -10,7 +10,8 @@ module.exports = {
es2015_name: ["./harmony", "default"],
es2015_alias: ["./harmony", "alias"],
es2015_year: ["./harmony", "year"],
"this.aaa": "./aaa"
"this.aaa": "./aaa",
esm: "./fff.mjs"
Copy link
Member

Choose a reason for hiding this comment

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

change this to esm: "fail"

import fff.mjs from index.js.

Use esm in fff.mjs. It should not be replaced. i. e.

export function() {
  return esm;
}

Currently you are not testing your change.

Signed-off-by: weiran.zsd <weiran.zsd@alibaba-inc.com>
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we鈥檒l review the pull request soon.

Co-Authored-By: Aladdin-ADD <weiran.zsd@outlook.com>
@sokra sokra merged commit 355590e into webpack:master Nov 5, 2018
@sokra
Copy link
Member

sokra commented Nov 5, 2018

Thanks

@aladdin-add aladdin-add deleted the patch-3 branch November 5, 2018 11:57
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.

None yet

3 participants