Skip to content
Ryan Christian edited this page Sep 22, 2020 · 7 revisions

Why is command x is in the Readme but it doesn't work ?

The Readme in Github points to master in preact-cli and that is the development branch so it's possible that some commands may still not be available in the last version but as soon as there is a bump in the version they will available. You can always rely on the Readme in NPM.

How do I modify SW config ?

We have a plugin for that preact-cli-sw-precache and this allows you customize SW as you please.

How do I change the template to add Google Analytics/Google Fonts ?

You can change the template being used to render your website with the --template flag. This is the default one and you can add your missing scripts here.

And change your package.json from:

preact build
to
preact build --template my-template.html

And

preact watch
to
preact watch --template my-template.html

Can I use other postcss plugins apart from autoprefixer ?

Sure you can man ! You can either edit the preact.config.js like in here or install the plugin that will read from your postcss.config.js

How can I use Flow/Typescript ?

As you may have guessed we have plugins for that this is the one for Flow and this is the one for typescript.

Any official way of handling tests in preact-cli ?

So far no , we are discussing that right here so you can join in the discussion.

Why no Redux/Mobx integration ?

Well in our idea this is more of a personal decision. First of all we know that not all websites will need a state manager and secondly building for one will cause more issues for the people using the other one so we made this stay in user land so you can you do as you please

Is there an eject option ?

At the moment no because we feel like we have the needed flexibility but if you believe there should be one please speak up in this issue.

You mention the preact.config.js but how do I change it ?

Well we have a Config Recipes that you can look for some inspiration and if you need more help feel free to reach out.

How can I extend the preact config to watch other folders?

You can use preact.config.js to extend the config for watching other folders structure.

// preact.config.js

export default function (config, env, helpers) {
  config.module.loaders[4].include = [
    path.resolve(__dirname, 'src', 'routes'),
    path.resolve(__dirname, 'src', 'components'),
    path.resolve(__dirname, 'src', 'sections')
  ];

  config.module.loaders[5].exclude = [
    path.resolve(__dirname, 'src', 'routes'),
    path.resolve(__dirname, 'src', 'components'),
    path.resolve(__dirname, 'src', 'sections')
  ];
}

Remember this overwrites the config for the loaders. So, you have to specify the default folders as well.

I'm stuck how can I talk to you guys ?

The preact team is on Slack and you can get an invite here