Closed
Description
Hi I saw this error when using webpack@4 and css-loader@2:
ERROR in ./applications/main/stylesheets/PortfolioSection.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
TypeError: Cannot read property 'type' of undefined
at /Users/stian/Desktop/t47io_main/node_modules/css-loader/node_modules/postcss-modules-local-by-default/index.js:389:21
at callback (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/container.es6:208:18)
at callback (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/container.es6:110:18)
at Root.callback [as each] (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/container.es6:76:16)
at Root.each (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/container.es6:107:17)
at Root.walk [as walkRules] (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/container.es6:206:19)
at /Users/stian/Desktop/t47io_main/node_modules/css-loader/node_modules/postcss-modules-local-by-default/index.js:384:9
at LazyResult.plugin [as run] (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:352:14)
at LazyResult.run [as asyncTick] (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:280:26)
at LazyResult.asyncTick (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:292:14)
at asyncTick (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:317:12)
at new Promise (<anonymous>)
at LazyResult.async (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:314:23)
at LazyResult.async [as then] (/Users/stian/Desktop/t47io_main/node_modules/postcss/lib/lazy-result.es6:201:17)
at Object.loader (/Users/stian/Desktop/t47io_main/node_modules/css-loader/dist/index.js:122:6)
at runLoaders (/Users/stian/Desktop/t47io_main/node_modules/webpack/lib/NormalModule.js:301:20)
at /Users/stian/Desktop/t47io_main/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /Users/stian/Desktop/t47io_main/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at context.callback (/Users/stian/Desktop/t47io_main/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at process.then.catch.error (/Users/stian/Desktop/t47io_main/node_modules/css-loader/dist/index.js:264:5)
@ ./applications/main/containers/PortfolioSection.jsx 24:0-59
@ ./applications/main/containers/index.jsx
@ ./build/render/server.jsx
@ multi bootstrap-loader ./build/render/server.jsx
So I tracked to the line in postcss-modules-local-by-default
and added a console.log(JSON.stringify(rule)
for debugging. Turned out this rule
is lacking parent
somehow, but I don't have much clue why. The following dump of the problematic rule
object contains the raw CSS, hope that would help:
{
"raws": {
"before": "",
"after": "",
"between": "",
"semicolon": false,
"left": "",
"right": ""
},
"type": "rule",
"nodes": [
{
"raws": {
"before": "",
"after": "",
"between": ":",
"important": "!important"
},
"type": "decl",
"source": {
"start": {
"line": 47,
"column": 5
},
"input": {
"css": ".PORTFOLIO__menu {\n text-align: center;\n overflow: hidden;\n margin-top: 1.5rem;\n margin-bottom: 3rem; }\n .PORTFOLIO__menu .PORTFOLIO__filters {\n list-style: none outside none;\n text-align: center; }\n .PORTFOLIO__menu .PORTFOLIO__filters .PORTFOLIO__filter-item {\n display: inline-block;\n cursor: pointer;\n will-change: transform, opacity; }\n .PORTFOLIO__menu .PORTFOLIO__filters .PORTFOLIO__filter-item.active .PORTFOLIO__filter-link {\n background: #72a603;\n color: #fff;\n font-weight: 900; }\n .PORTFOLIO__menu .PORTFOLIO__filters .PORTFOLIO__filter-item .PORTFOLIO__filter-link {\n color: #363940;\n background: transparent;\n display: inline-block;\n margin: 0.25rem;\n padding: 0.5rem 0.75rem;\n text-decoration: none;\n text-transform: uppercase; }\n .PORTFOLIO__menu .PORTFOLIO__filters .PORTFOLIO__filter-item .PORTFOLIO__filter-link:hover {\n background: #9fc906;\n color: #fff; }\n\n.PORTFOLIO__content {\n overflow: hidden; }\n\n.PORTFOLIO__div div {\n padding: 0;\n margin: 0 auto; }\n\n.PORTFOLIO__item {\n position: relative;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 5;\n overflow: hidden; }\n .PORTFOLIO__item .SVG {\n border: 1px solid #cfd8dc;\n margin-left: -1px;\n margin-top: -1px;\n width: 100%;\n position: relative;\n top: 0;\n left: 0;\n z-index: 6;\n cursor: pointer;\n transition-duration: 1s; }\n .PORTFOLIO__item .PORTFOLIO__text {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n text-align: center;\n opacity: 0;\n color: transparent;\n background: none repeat scroll 0 0 rgba(114, 166, 3, 0.75);\n transition-duration: 0.6s;\n transform: scale(0); }\n .PORTFOLIO__item:hover .SVG {\n transform: scale(1.5); }\n .PORTFOLIO__item:hover .SVG .SVG--1,\n .PORTFOLIO__item:hover .SVG .SVG--2 {\n opacity: 0;\n visibility: hidden; }\n .PORTFOLIO__item:hover .PORTFOLIO__text {\n opacity: 1;\n padding: 0 2rem;\n color: #fff;\n transform: scale(1); }\n .PORTFOLIO__item:hover .PORTFOLIO__text .PORTFILIO__text-link {\n color: inherit;\n display: block;\n font-size: 2rem;\n font-weight: 900;\n margin-top: 30%;\n padding-bottom: 1.5rem;\n text-decoration: none;\n font-variant: small-caps; }\n .PORTFOLIO__item:hover .PORTFOLIO__text .PORTFILIO__text-description {\n font-size: 1.25em;\n font-weight: normal;\n line-height: 1.5rem;\n margin: 0;\n padding: 0; }\n\n.PORTFOLIO__power-by .PORTFOLIO__find-more {\n line-height: 1.5rem; }\n\n.PORTFOLIO__power-by .PORTFOLIO__brands {\n line-height: 2.5rem;\n padding: 1rem 0;\n margin: 0; }\n\n.PORTFOLIO__power-by .PORTFOLIO__brand-item {\n list-style: none;\n display: inline-block;\n will-change: transform, opacity; }\n\n.PORTFOLIO__power-by svg {\n height: 2.5rem;\n width: 2.5rem;\n margin: 0 0.5rem; }\n .PORTFOLIO__power-by svg :global .brand-logo__open,\n .PORTFOLIO__power-by svg :global .brand-logo__filled,\n .PORTFOLIO__power-by svg :global .brand-logo__extra {\n transition-duration: 0.25s; }\n .PORTFOLIO__power-by svg :global .brand-logo__open {\n fill: #eee;\n stroke: #eee; }\n .PORTFOLIO__power-by svg :global .brand-logo__filled {\n fill: #9fc906;\n stroke: #9fc906; }\n .PORTFOLIO__power-by svg :global .brand-logo__extra {\n fill: #888; }\n .PORTFOLIO__power-by svg:hover :global .brand-logo__open,\n .PORTFOLIO__power-by svg:hover :global .brand-logo__extra {\n fill: #9fc906;\n stroke: #9fc906; }\n .PORTFOLIO__power-by svg:hover :global .brand-logo__filled {\n fill: #888;\n stroke: #888; }\n\n@media only screen and (max-width: 767px) {\n .PORTFOLIO__wrapper {\n padding: 0; } }\n",
"hasBOM": false,
"file": "/Users/stian/Desktop/t47io_main/applications/main/stylesheets/PortfolioSection.scss"
},
"end": {
"line": 47,
"column": 16
}
},
"prop": "width",
"value": "100%",
"_autoprefixerDisabled": false,
"_autoprefixerGridStatus": false,
"important": false
},
{
"raws": {
"before": "",
"after": "",
"between": ":",
"important": "!important"
},
"type": "decl",
"source": {
"start": {
"line": 48,
"column": 5
},
"input": {
"css": "...", // same as above
"hasBOM": false,
"file": "/Users/stian/Desktop/t47io_main/applications/main/stylesheets/PortfolioSection.scss"
},
"end": {
"line": 48,
"column": 23
}
},
"prop": "position",
"value": "relative",
"_autoprefixerDisabled": false,
"_autoprefixerGridStatus": false,
"important": false
},
{
"raws": {
"before": "",
"after": "",
"between": ":",
"important": "!important"
},
"type": "decl",
"source": {
"start": {
"line": 49,
"column": 5
},
"input": {
"css": "...", // same as above
"hasBOM": false,
"file": "/Users/stian/Desktop/t47io_main/applications/main/stylesheets/PortfolioSection.scss"
},
"end": {
"line": 49,
"column": 11
}
},
"prop": "top",
"value": "0",
"_autoprefixerDisabled": false,
"_autoprefixerGridStatus": false,
"important": false
},
{
"raws": {
"before": "",
"after": "",
"between": ":",
"important": "!important"
},
"type": "decl",
"source": {
"start": {
"line": 50,
"column": 5
},
"input": {
"css": "...", // same as above
"hasBOM": false,
"file": "/Users/stian/Desktop/t47io_main/applications/main/stylesheets/PortfolioSection.scss"
},
"end": {
"line": 50,
"column": 12
}
},
"prop": "left",
"value": "0",
"_autoprefixerDisabled": false,
"_autoprefixerGridStatus": false,
"important": false
}
],
"selector": ".PORTFOLIO__item,.PORTFOLIO__item .SVG",
"lastEach": 2,
"indexes": {}
}
Any hint is appreciated, thanks a lot in advance!!
Metadata
Metadata
Assignees
Labels
No labels