Fix ERR_REQUIRE_ESM when trim-newlines@4 in tree
See original GitHub issueWhat steps are needed to reproduce the bug?
If trim-newsline v4 is added to resolutions.
What Stylelint configuration is needed to reproduce the bug?
{
"plugins": [
"stylelint-declaration-strict-value",
"stylelint-declaration-block-no-ignored-properties",
"stylelint-order",
"stylelint-scss",
"stylelint-no-px",
"stylelint-prettier"
],
"extends": [
"stylelint-config-standard",
"stylelint-config-standard-scss",
"stylelint-prettier/recommended",
"stylelint-config-prettier"
],
"customSyntax": "postcss-scss",
"rules": {
"selector-class-pattern": null,
"keyframes-name-pattern": null,
"custom-property-pattern": null,
"scss/operator-no-newline-after": null,
"alpha-value-notation": "number",
"at-rule-disallowed-list": ["debug", "extend"],
"at-rule-no-vendor-prefix": true,
"block-no-empty": true,
"color-function-notation": "legacy",
"color-hex-length": "short",
"color-named": "never",
"color-no-invalid-hex": true,
"scss/comment-no-empty": null,
"scss/dollar-variable-empty-line-before": null,
"scss/double-slash-comment-empty-line-before": null,
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-single-line-max-declarations": 1,
"declaration-no-important": true,
"declaration-property-value-disallowed-list": {
"/.+/": ["initial"],
"/^border/": ["none"],
"/^transition/": ["/all/"]
},
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"function-calc-no-unspaced-operator": true,
"function-linear-gradient-no-nonstandard-direction": true,
"function-url-quotes": "always",
"function-whitespace-after": "always",
"length-zero-no-unit": true,
"max-nesting-depth": [
3,
{
"ignoreAtRules": ["function", "each", "else", "if", "include", "media", "supports"]
}
],
"media-feature-name-no-vendor-prefix": true,
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"meowtec/no-px": [
true,
{
"ignoreFunctions": ["px-to-em", "px-to-rem"]
}
],
"no-duplicate-selectors": true,
"order/order": [
[
"custom-properties",
"dollar-variables",
{
"type": "at-rule",
"name": "extend"
},
{
"type": "at-rule",
"name": "include",
"hasBlock": false
},
"declarations",
{
"type": "at-rule",
"name": "include",
"hasBlock": true
},
"rules"
]
],
"order/properties-order": [
[
"position",
"z-index",
"top",
"right",
"bottom",
"left",
"display",
"overflow",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"box-sizing",
"grid",
"grid-area",
"grid-template",
"grid-template-areas",
"grid-template-rows",
"grid-template-columns",
"grid-row",
"grid-row-start",
"grid-row-end",
"grid-column",
"grid-column-start",
"grid-column-end",
"grid-auto-rows",
"grid-auto-columns",
"grid-auto-flow",
"gap",
"grid-gap",
"grid-row-gap",
"grid-column-gap",
"flex",
"flex-basis",
"flex-direction",
"flex-flow",
"flex-grow",
"flex-shrink",
"flex-wrap",
"align-content",
"align-items",
"align-self",
"justify-content",
"order",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"border",
"border-top",
"border-right",
"border-bottom",
"border-left",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left"
],
{
"unspecified": "bottomAlphabetical"
}
],
"plugin/declaration-block-no-ignored-properties": true,
"prettier/prettier": true,
"property-no-unknown": true,
"property-no-vendor-prefix": true,
"scale-unlimited/declaration-strict-value": [
["color", "z-index"],
{
"ignoreKeywords": {
"": ["currentColor", "inherit", "transparent"],
"z-index": 0
}
}
],
"scss/at-extend-no-missing-placeholder": true,
"scss/at-function-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$",
"scss/at-import-no-partial-leading-underscore": true,
"scss/at-import-partial-extension-blacklist": ["scss"],
"scss/at-mixin-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$",
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"scss/dollar-variable-colon-space-after": "at-least-one-space",
"scss/dollar-variable-colon-space-before": "never",
"scss/dollar-variable-pattern": "^[_]?[a-z]+([a-z0-9-_]+[a-z0-9]+)?$",
"scss/percent-placeholder-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$",
"scss/selector-no-redundant-nesting-selector": true,
"selector-max-attribute": 2,
"selector-max-class": 3,
"selector-max-compound-selectors": 3,
"selector-max-id": 0,
"selector-max-specificity": "0,3,0",
"selector-max-universal": 1,
"selector-no-qualifying-type": true,
"selector-no-vendor-prefix": true,
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-element-no-unknown": true,
"shorthand-property-no-redundant-values": true,
"value-no-vendor-prefix": true
}
}
How did you run Stylelint?
CLI with stylelint **/*.scss
Which version of Stylelint are you using?
14.1.0
What did you expect to happen?
Work
What actually happened?
$ stylelint **/*.scss
/Users/user/project/node_modules/meow/index.js:159
if (!options.allowUnknownFlags) {
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/user/project/node_modules/trim-newlines/index.js from /Users/user/project/node_modules/meow/index.js not supported.
Instead change the require of /Users/user/project/node_modules/trim-newlines/index.js in /Users/user/project/node_modules/meow/index.js to a dynamic import() which is available in all CommonJS modules.
Does the bug relate to non-standard syntax?
No response
Proposal to fix the bug
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The node-fetch latest version doesn't use the require() syntax to import the package. You need to go to your package.json and type
Read more >Mocha - the fun, simple, flexible JavaScript test framework
Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. Hosted on GitHub.
Read more >Underscore.js
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.
Read more >TSConfig Reference - Docs on every TSConfig option
A module file is a file that has imports and/or exports. Without this flag, using an export from a UMD module requires an...
Read more >Webpack 5 release (2020-10-10)
As with webpack 4 we continue development by fixing problems and ... Improve bundle size with better Tree Shaking and Code Generation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
IMHO this is not a bug. If one chooses to use resolutions, then they know what they are doing. In this case, it means they are using a major version bump explicitly…
@semihraifgurel I see your situation.
We need to update also
meow
to use the latest version oftrim-newlines
, but unfortunately,meow
is a pure ESM package, and we need to resolve #5291 which is a hard task… 😢