-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
Feature request
Currently webpack exports using quote notation and imports using dot notation.
e.g., look at the use of the "a" property:
...
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "a": function() { return /* binding */ ActionOperation; }
/* harmony export */ });
...
var ActionOperation = __webpack_require__(86792);
class ProcessActionOperation extends ActionOperation/* ActionOperation */.a {
...
Some optimizing compilers such as the Google Closure Compiler see these as different. They use the quote notation as a way to say, "hands off" when it comes to minifying variable names so that external interfaces can be preserved. This leads to it seeing x["somevar"] and x.somevar as two different properties, such that x.somevar is minified and x["somevar"] is converted to x.somevar (shorter by one char but not minified). See the Closure docs for more.
What is the expected behavior?
It's important for webpack to be consistent in the generation and consumption of properties - either dot notation or quote notation. This was mostly OK in webpack 4; webpack 5 introduced breaking changes.
What is motivation or use case for adding/changing the behavior?
Get webpack 5 to generate output compatible with the Google Closure Compiler.
How should this be implemented in your opinion?
The proposed change is relatively straightforward. A new method propertyName will be introduced using similar logic to propertyAccess. This will be used instead of JSON.stringify when creating property names.
Are you willing to work on this yourself?
Yes
Metadata
Metadata
Assignees
Labels
Type
Projects
Status