Support array of plugins declared as strings.

Abierto
#221 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
javascript, node.js
Área
tooling

Línea de trabajo

Start with src/plugins.js, where the error is raised, and trace how src/index.js passes the configuration through. Use the provided test.js reproduction with the shown postcss.config.js; done means string plugin declarations load successfully while the existing plugin-with-options form and plugin order continue to work.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Details

This postcss config works with webpack but postcss-load-config gives an error:

// postcss.config.js
module.exports = ({file}) => ({
    plugins: [
        // Warning: order is significant
        "postcss-nested",
        "postcss-extend-rule",
        [
            "postcss-simple-vars",
            {
                test_option: 'some value'
            },
        ],
        "postcss-calc",
        "postcss-media-minmax",
        "autoprefixer",
    ],
});

Am I doing something fundamentally incorrect or is this not supported?

Error:

Error (Logs|Stacks)

TypeError: Invalid PostCSS Plugin found at: plugins[0]

(@/srv/zulip/postcss.config.js)
    at /srv/zulip-npm-cache/f2739c284982d35277414af484c763f882870575/node_modules/postcss-load-config/src/plugins.js:77:15
    at Array.forEach (<anonymous>)
    at plugins (/srv/zulip-npm-cache/f2739c284982d35277414af484c763f882870575/node_modules/postcss-load-config/src/plugins.js:58:13)
    at processResult (/srv/zulip-npm-cache/f2739c284982d35277414af484c763f882870575/node_modules/postcss-load-config/src/index.js:37:14)
    at /srv/zulip-npm-cache/f2739c284982d35277414af484c763f882870575/node_modules/postcss-load-config/src/index.js:172:10
    at Function.sync (/srv/zulip-npm-cache/f2739c284982d35277414af484c763f882870575/node_modules/postcss-load-config/src/index.js:99:12)
    at assert_conversion (/srv/frontend_tests/node_tests/postcss.js:17:42)
... <further traceback is our calling code>
Reproduction (Code)
// test.js
const postcss = require("postcss");
const postcssrc = require('postcss-load-config');
const ctx = { parser: true, map: false, file: "/path/index.css"};
const {plugins, options} = postcssrc.sync(ctx);

Run node test.js.

Environment
OS node npm/yarn package
Ubuntu 20.04 v14.17.3 6.14.13 1.22.10
Lenguaje dominante
JavaScript
Estrellas
661
Forks
76
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de postcss/postcss-load-config

Todos los issues de postcss/postcss-load-config

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.