You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation is in the issue comments that I linked above. Bottom line is that I'm using Typescript+Webpack+NodeJS and the import() calls get transpiled into require so the import ignore feature doesn't work for me I need the same for require() calls.
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
Yes.
Does this PR introduce a breaking change?
Not that I'm aware of. It's a new feature.
What needs to be documented once your changes are merged?
You can enable magic comment for CommonJs with module.parser.javascript.commonjsMagicComments: true and in Rule.parser.commonjsMagicComments: true.
With that enabled you can use the webpackIgnore: true magic comment for require calls as well: https://webpack.js.org/api/module-methods/#commonjs
Some configuration options has been moved to parser objects as well:
All have been moved to module.parser.javascript.xxx resp. Rule.parser.xxx
If that's not already in the docs: To get the parser options of a module the options in module.parser.[module-type] are merged with Rule.parser. The same for the generator options.
If the module type contains / the base module type options are also merged. e.g. for javascript/esm: module.parser.javascript + module.parser["javascript/esm"] + Rule.parser (could be multiple, if multiple rules match).
The text was updated successfully, but these errors were encountered:
A pull request by @petermetz was merged and maintainers requested a documentation change.
See pull request: webpack/webpack#11316
A partial port of the same magic comments that are supported
for import() calls already via this commit:
webpack/webpack@f65e9da
Fixes webpack/webpack#11311
Signed-off-by: Peter Somogyvari peter.metz@unarin.com
Motivation is in the issue comments that I linked above. Bottom line is that I'm using Typescript+Webpack+NodeJS and the import() calls get transpiled into require so the import ignore feature doesn't work for me I need the same for require() calls.
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
Yes.
Does this PR introduce a breaking change?
Not that I'm aware of. It's a new feature.
What needs to be documented once your changes are merged?
You can enable magic comment for CommonJs with
module.parser.javascript.commonjsMagicComments: true
and inRule.parser.commonjsMagicComments: true
.With that enabled you can use the
webpackIgnore: true
magic comment for require calls as well: https://webpack.js.org/api/module-methods/#commonjsSome configuration options has been moved to parser objects as well:
module.{expr|wrapped|unknown}Context{Request|RegExp|Recursive|Critical}
module.strictExportPresence
module.strictThisContextOnImports
module.parser.javascript.xxx
resp.Rule.parser.xxx
module.parser.[module-type]
are merged withRule.parser
. The same for the generator options./
the base module type options are also merged. e.g. forjavascript/esm
:module.parser.javascript
+module.parser["javascript/esm"]
+Rule.parser
(could be multiple, if multiple rules match).The text was updated successfully, but these errors were encountered: