Progressive Web App with Laravel Mix

profile picture

Progressive Web App with Laravel Mix

Story short, here's how your webpack.mix.js should look like:

let mix = require('laravel-mix');

let SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');

    plugins: [
        new SWPrecacheWebpackPlugin({
            cacheId: 'pwa',
            filename: 'service-worker.js',
            staticFileGlobs: ['public/**/*.{css,eot,svg,ttf,woff,woff2,js,html}'],
            minify: true,
            stripPrefix: 'public/',
            handleFetch: true,
            dynamicUrlToDependencies: {
                '/': ['resources/views/welcome.blade.php'],
            staticFileGlobsIgnorePatterns: [/\.map$/, /mix-manifest\.json$/, /manifest\.json$/, /service-worker\.js$/],
            runtimeCaching: [
                    urlPattern: /^https:\/\/fonts\.googleapis\.com\//,
                    handler: 'cacheFirst'
            importScripts: ['./js/push_message.js']

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');
progressive web app

about me

profile picture

I consider myself as an IT Business Artisan. Or Consultant CTO if you prefer. I'm a self-taught Web Developper, coach and teacher. My main work is helping and guiding digital startups.

more about me

follow me


A weekly email with the latests articles

2020 My Dynamic Production SPRL All rights Reserved.