diff --git a/purs/package.json b/purs/package.json index 616e54f..f46e632 100644 --- a/purs/package.json +++ b/purs/package.json @@ -6,8 +6,8 @@ "purs": "purs", "make-install": "make install", "make-watch": "inotifywait -m -r -q -e close_write --format '%T %w%f' --timefmt '%T' src | while read FILE; do echo $FILE; make; done", - "esbuild-bundle": "esbuild ./output/Main/index.js --bundle --format=iife --global-name=PS --target=chrome58,firefox57,edge18 --outfile=dist/app.js", - "esbuild-bundle-min": "esbuild ./output/Main/index.js --bundle --format=iife --global-name=PS --target=chrome58,firefox57,edge18 --minify --sourcemap --outfile=dist/app.min.js" + "esbuild-bundle": "esbuild ./output/Main/index.js --bundle --format=esm --target=chrome61,firefox60,edge18 --outfile=dist/app.js", + "esbuild-bundle-min": "esbuild ./output/Main/index.js --bundle --format=esm --target=chrome61,firefox60,edge18 --minify --sourcemap --outfile=dist/app.min.js" }, "devDependencies": { "esbuild": "^0.19.11", diff --git a/src/Foundation.hs b/src/Foundation.hs index 7ebcd97..a58e81c 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -87,6 +87,8 @@ instance Yesod App where then sslOnlyMiddleware session_timeout_minutes else id) handler + jsAttributes _ = [("type", "module")] + defaultLayout widget = do req <- getRequest master <- getYesod @@ -123,14 +125,15 @@ instance Yesod App where |] + isAuthenticated :: Handler AuthResult isAuthenticated = maybeAuthId >>= \case Just authId -> pure Authorized _ -> pure $ AuthenticationRequired addAppScripts :: (MonadWidget m, HandlerSite m ~ App) => m () -addAppScripts = do - addScript (StaticR js_app_min_js) +addAppScripts = do pure () + -- addScriptAttrs (StaticR js_app_min_js) [("type","module")] -- popupLayout diff --git a/src/Handler/AccountSettings.hs b/src/Handler/AccountSettings.hs index 88830aa..466c9d5 100644 --- a/src/Handler/AccountSettings.hs +++ b/src/Handler/AccountSettings.hs @@ -14,8 +14,10 @@ getAccountSettingsR = do app.userR = "@{UserR (UserNameP $ userName user)}"; app.dat.accountSettings = #{ toJSON accountSettings } || []; |] - toWidget [julius| - PS.renderAccountSettings('##{rawJS accountSettingsEl}')(app.dat.accountSettings)(); + toWidget [hamlet| +