mirror of https://github.com/msgbyte/tailchat
chore: 调整workbox的正则表达式
parent
021b1906f9
commit
d57a091d2d
@ -0,0 +1,14 @@
|
||||
import { workboxPluginPattern } from '../utils';
|
||||
|
||||
describe('workboxPluginPattern', () => {
|
||||
test.each([
|
||||
['/plugins/com.msgbyte.foo/bar.js', true],
|
||||
['/plugins/com.msgbyte.foo.foz/bar.js', true],
|
||||
['/plugins/com.msgbyte.foo/index.js', false],
|
||||
['/plugins/com.msgbyte.foo/index-abcde.js', false], // TODO: 这个期望是true的。但是不会写正则
|
||||
['/plugins/com.msgbyte.foo/index.woff', false],
|
||||
['/plugins/com.msgbyte.foo/font.woff', false],
|
||||
])('%s: %p', (input, output) => {
|
||||
expect(workboxPluginPattern.test(input)).toBe(output);
|
||||
});
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* workbox 匹配plugin的缓存
|
||||
*/
|
||||
export const workboxPluginPattern =
|
||||
/plugins\/com\.msgbyte(.*?)\/((?!index).)*?\.js/;
|
Loading…
Reference in New Issue