Skip to content

Commit 42418f2

Browse files
MathieuPuechdaKmoR
authored andcommitted
fix: disable service worker for local development
1 parent cadd858 commit 42418f2

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

.changeset/lazy-nails-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket/cli': patch
3+
---
4+
5+
Disable the service worker for local development

packages/cli/preset/_includes/_joiningBlocks/bottom/180-register-service-worker.njk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
window.__rocketServiceWorkerUrl = '{{ rocketServiceWorkerUrl | url }}';
55
</script>
66

7+
{% if rocketConfig.command == 'build' %}
78
<script type="module" inject-service-worker="" src="{{ '/_assets/scripts/registerServiceWorker.js' | asset | url }}"></script>
9+
{% endif %}

packages/cli/test-node/RocketCli.preset.test.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('RocketCli preset', () => {
1919
}
2020
});
2121

22-
it('offers a default layout (with head, header, content, footer, bottom) and raw layout', async () => {
22+
it.only('offers a default layout (with head, header, content, footer, bottom) and raw layout', async () => {
2323
cli = await executeStart('preset-fixtures/default/rocket.config.js');
2424

2525
const rawHtml = await readStartOutput(cli, 'raw/index.html');
@@ -86,12 +86,6 @@ describe('RocketCli preset', () => {
8686
' </div>',
8787
'',
8888
' <footer id="main-footer"></footer>',
89-
'',
90-
' <script',
91-
' type="module"',
92-
' inject-service-worker=""',
93-
' src="/_merged_assets/scripts/registerServiceWorker.js"',
94-
' ></script>',
9589
' </body>',
9690
'</html>',
9791
].join('\n'),

packages/cli/test-node/RocketCli.service-worker.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('RocketCli e2e', () => {
3131
}
3232
});
3333

34-
it('will add a script to inject the service worker', async () => {
34+
it.only('will add a script to inject the service worker', async () => {
3535
cli = await executeBuild('e2e-fixtures/service-worker/rocket.config.js');
3636
const indexHtml = await readStartOutput(cli, 'index.html');
3737
const indexInject = getInjectServiceWorker(indexHtml);

packages/launch/test-node/RocketLaunch.preset.test.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('RocketLaunch preset', () => {
1919
}
2020
});
2121

22-
it('sets layout-sidebar as default', async () => {
22+
it.only('sets layout-sidebar as default', async () => {
2323
cli = await executeStart('fixtures/layout-sidebar/rocket.config.js');
2424

2525
const indexHtml = await readStartOutput(cli, 'page/index.html', {
@@ -244,12 +244,6 @@ describe('RocketLaunch preset', () => {
244244
' </footer>',
245245
'',
246246
' <script type="module" src="/_merged_assets/scripts/init-navigation.js"></script>',
247-
'',
248-
' <script',
249-
' type="module"',
250-
' inject-service-worker=""',
251-
' src="/_merged_assets/scripts/registerServiceWorker.js"',
252-
' ></script>',
253247
' </body>',
254248
'</html>',
255249
].join('\n'),

0 commit comments

Comments
 (0)