1- const TerserPlugin = require ( "terser-webpack-plugin" ) ;
1+ const IS_DEV = process . env . NODE_ENV === "development" ;
2+
23const withPlugins = require ( "next-compose-plugins" ) ;
3- const withPWA = require ( "next-pwa" ) ;
44const withTM = require ( "next-transpile-modules" ) ( [
55 // region @editor -app
66 "@editor-app/live-session" ,
@@ -60,6 +60,16 @@ const withTM = require("next-transpile-modules")([
6060 // -----------------------------
6161] ) ;
6262
63+ const withPWA = require ( "next-pwa" ) ( {
64+ register : true ,
65+ dest : "public" ,
66+ disable : IS_DEV ,
67+ fallbacks : {
68+ image : "/images/fallback.png" ,
69+ document : "/_offline" ,
70+ } ,
71+ } ) ;
72+
6373module . exports = withPlugins (
6474 [
6575 [ withTM ] ,
@@ -75,32 +85,11 @@ module.exports = withPlugins(
7585 ] ,
7686 {
7787 webpack : ( config ) => {
78- config . module . rules . push ( {
79- type : "javascript/auto" ,
80- test : / \. m j s $ / ,
81- include : / n o d e _ m o d u l e s / ,
82- } ) ;
83-
8488 config . resolve . fallback = {
8589 fs : false , // used by handlebars
8690 path : false , // used by handlebars
87- crypto : false , // or crypto-browserify (used for totp auth)
88- stream : false , // or stream-browserify (used for totp auth)
8991 } ;
9092
91- // -----------------------------
92- // for @flutter -builder classname issue
93- config . optimization . minimizer . push (
94- new TerserPlugin ( {
95- parallel : true ,
96- terserOptions : {
97- // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
98- keep_classnames : true ,
99- } ,
100- } )
101- ) ;
102- // -----------------------------
103-
10493 return config ;
10594 } ,
10695 async redirects ( ) {
0 commit comments