Closed
Description
- Operating System: macOS Catalina
- Node Version: 14.15.1
- NPM Version: 6.14.8
- webpack Version: 4.42.1
- postcss-loader Version: 4.0.4
Expected Behavior
No failure with the valid postcss.config.js
.
Actual Behavior
Seeing an error
Module build failed (from ./node_modules/gatsby-plugin-postcss/node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read property 'map' of undefined
at Object.module.exports [as config] (project_dir/postcss.config.js:84:20)
at loadConfig (project_dir/node_modules/gatsby-plugin-postcss/node_modules/postcss-loader/dist/utils.js:89:28)
at async Object.loader (project_dir/node_modules/gatsby-plugin-postcss/node_modules/postcss-loader/dist/index.js:53:22)
Code
postcss.config.js
(especially line 84
mentioned in the error) has a config
module.exports = (ctx) => ({
map: ctx.options.map, // this one is line 84
plugins: [
...
It's a valid syntax as specified in postcss-cli docs, and postcss-cli
works fine on it, only when this config is being loaded by postcss-loader
in the context of gatsby-plugin-postcss
then it fails.
Additional Context
It happens during the Gatsby build, when gatsby-plugin-postcss uses postcss-loader
to read the config. I have NOT opened an issue with gatsby-plugin-postcss
. The project is using gatsby-plugin-postcss
version 3.1.0
.
Metadata
Metadata
Assignees
Labels
No labels