zouhir/jarvis

How to use it with preact-cli preact.config.js ?

azulkipli opened this issue · 1 comments

In preact.config.js I already have

import criticalCssPlugin from "preact-cli-plugin-critical-css";
import Jarvis from "webpack-jarvis";
/* the rest of your webpack configs */

export default (config, env) => {
  const options = {
    // Passed directly to the 'critical' module (this is optional)
  };

  criticalCssPlugin(config, env, options);
};

Thanks

Hey, you can modify the config first before passing it into criticalCssPlugin:

const Jarvis = require("webpack-jarvis");
const critical = require("preact-cli-plugin-critical-css");

module.exports = (config, env) => {
  config.plugins.push(
    new Jarvis({ /*jarvis options*/ })
  );

  critical(config, env, { /*critical options*/ });
};