Vue Workbox Webpack "cannot use import statement outside a module"

Viewed 1472

I'm trying to use workbox for the first time but I always get the following error:

Uncaught SyntaxError: Cannot use import statement outside a module

This is my src-sw.js

import {precacheAndRoute} from 'workbox-precaching';

precacheAndRoute(self.__WB_MANIFEST);

I couldn't find anything in the workbox documentation in regards to this problem. How do I handle this?

1 Answers
Related