-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
docs(configuration): document webpackIgnore for commonjs #4476
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ module.exports = { | |
}; | ||
``` | ||
|
||
## `module.parser` | ||
## module.parser | ||
|
||
<Badge text='5.12.0+' /> | ||
|
||
|
@@ -107,6 +107,51 @@ module.exports = { | |
}; | ||
``` | ||
|
||
|
||
### module.parser.javascript | ||
|
||
Configure options for JavaScript parser. | ||
|
||
```js | ||
module.exports = { | ||
module: { | ||
parser: { | ||
javascript: { | ||
// ... | ||
commonjsMagicComments: true, | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
It's allowed to configure those options in [`Rule.parser`](/configuration/module/#ruleparser) as well to target specific modules. | ||
|
||
#### module.parser.javascript.commonjsMagicComments | ||
|
||
Enable [magic comments](/api/module-methods/#magic-comments) support for CommonJS. | ||
|
||
- Type: `boolean` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually put the types below the title, Why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's explicit, and I believe it's much readable. Moreover, with explicit format we could possibly customize those complex types with |
||
- Available: 5.17.0+ | ||
- Example: | ||
```js | ||
module.exports = { | ||
module: { | ||
parser: { | ||
javascript: { | ||
commonjsMagicComments: true, | ||
}, | ||
} | ||
}, | ||
}; | ||
``` | ||
|
||
Note that only `webpackIgnore` comment is supported at the moment: | ||
|
||
```js | ||
const x = require(/* webpackIgnore: true */ 'x'); | ||
``` | ||
|
||
## `module.noParse` | ||
|
||
`RegExp` `[RegExp]` `function(resource)` `string` `[string]` | ||
|
@@ -421,6 +466,7 @@ module.exports = { | |
browserify: false, // disable special handling of Browserify bundles | ||
requireJs: false, // disable requirejs.* | ||
node: false, // disable __dirname, __filename, module, require.extensions, require.main, etc. | ||
commonjsMagicComments: false, // disable magic comments support for CommonJS | ||
node: {...}, // reconfigure [node](/configuration/node) layer on module level | ||
worker: ["default from web-worker", "..."] // Customize the WebWorker handling for javascript files, "..." refers to the defaults. | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.