Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

TypeError: Cannot match against 'undefined' or 'null'. #2

Closed
mrtomhoward opened this issue May 16, 2018 · 1 comment
Closed

TypeError: Cannot match against 'undefined' or 'null'. #2

mrtomhoward opened this issue May 16, 2018 · 1 comment
Labels

Comments

@mrtomhoward
Copy link

mrtomhoward commented May 16, 2018

I've been using 1.1.0 for a few months without issue.

When I upgraded to 1.2.0 and updated preact.config.js as per the doc, I keep getting this error on build:

Error: Error at /{preact-dir}/preact.config.js:
TypeError: Cannot match against 'undefined' or 'null'.

I get this same error whether my preact.config.js is verbatim from the doc:

import envVars from 'preact-cli-plugin-env-vars';

export default function (config, env, helpers) {
  envVars(config, env, helpers);
}

.... or with my customizations that were in the previous working version:

const envVars = require('preact-cli-plugin-env-vars')
const preactCliSwPrecachePlugin = require('preact-cli-sw-precache')

export default function (config, env, helpers) {

  envVars(config, env, helpers)

  const precacheConfig = {
    staticFileGlobs: [
      'app/css/**.css',
      'app/**.html',
      'app/images/**.*',
      'app/js/**.js'
    ],
    stripPrefix: 'app/',
    runtimeCaching: [{
      urlPattern: /this\\.is\\.a\\.regex/,
      handler: 'networkFirst'
    }]
  };

  return preactCliSwPrecachePlugin(config, precacheConfig)

}

Everything works fine again when I revert to 1.1.0 and change preact.config.js back to the way it was.

Any ideas on what I'm doing wrong?

@robinvdvleuten
Copy link
Owner

@mrtomhoward thanks for reporting this! I guess it slipped through with my own project's preact configuration. It should be fixed in v1.2.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants