swpp-backends 2.3.8 → 2.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,13 @@ function buildDomJs() {
20
20
  throw '功能未开启';
21
21
  }
22
22
  let template = fs_1.default.readFileSync(path_1.default.resolve('./', module.path, 'resources/sw-dom.js'), 'utf-8');
23
- if (config.onsuccess)
24
- template = template.replaceAll('const {onSuccess} = require(\'../config\')', `const onSuccess = ${config.onsuccess.toString()};`);
23
+ const key = 'const {onSuccess} = require(\'../config\')';
24
+ if (config.onsuccess) {
25
+ template = template.replaceAll(key, `const onSuccess = ${config.onsuccess.toString()};`);
26
+ }
27
+ else {
28
+ template = template.replaceAll(key, '');
29
+ }
25
30
  return template;
26
31
  }
27
32
  exports.buildDomJs = buildDomJs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swpp-backends",
3
- "version": "2.3.8",
3
+ "version": "2.3.9",
4
4
  "main": "dist/index.js",
5
5
  "typings": "types/index.d.ts",
6
6
  "description": "Generate a powerful ServiceWorker for your website.",