From 3161e4543445f14b1a54c9cd36eb82b4e35b868c Mon Sep 17 00:00:00 2001 From: migbash <20924663+migbash@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:54:31 +0100 Subject: [PATCH] upd: #1278; preloadStrategy -> preload-js; cont; --- vite.config.ts | 152 ++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 9fd1201df..3e8fe9632 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,85 +30,85 @@ export default defineConfig // ### 'this' plugin removes all 'CSS' from standard // ### importing by 'svelte/svelteki' and styles will be missing // ### if not imported as a '' in the 'src/app.html' - cssInjectedByJsPlugin - ( - { - - // relativeCSSInjection: true, - - // topExecutionPriority: true, - - // jsAssetsFilterFunction: function customJsAssetsfilterFunction - // ( - // outputChunk - // ) - // { - - // // [🐞] - // // ### NOTE: - // // ### It appears, the 'outputChunk.filename' is of type: - // // ### - _app/immutable/chunks/index.088b98a6.js - // // ### - _app/immutable/chunks/index.8e8ca4ce.js - // // ### etc. - // // console.log(outputChunk.fileName); - - // return outputChunk.fileName == 'index.js'; - // } - - // ### NOTE: - // ### definitive 'hack' solution for 'single CSS file' output chunk. - injectCode: - ( - cssCode, - options - ): string => - { - - const generateOneCssFile: boolean = false; - - if (generateOneCssFile) - { - // ### NOTE: - // ### the 'cssCode' generated contains some 'formatting' issues. - // ### remove 1st and last speech marks. - // ### remove cases of `\n` chars. - // ### correct custom case of 'ids'/'classes' using the 'forward-slash' in the declaration. - let cssCodeMod: string = cssCode.slice(1, -1); - cssCodeMod = cssCodeMod.replace(/\\n/g, ""); - cssCodeMod = cssCodeMod.replace(/\\\\/g,"\\") - - // ### WARNING: - // ### 'all-css-chunk.css' must exist inside '/static' - fs.writeFile - ( - './static/all-css-chunk.css', - cssCodeMod, - err => - { - if (err) console.error(err); - } - ); - } - - return ''; - - // return `try{if(typeof document != 'undefined'){var elementStyle = document.createElement('style');elementStyle.appendChild(document.createTextNode(${cssCode}));document.head.appendChild(elementStyle);}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}` - } - - } - ), + // cssInjectedByJsPlugin + // ( + // { + + // // relativeCSSInjection: true, + + // // topExecutionPriority: true, + + // // jsAssetsFilterFunction: function customJsAssetsfilterFunction + // // ( + // // outputChunk + // // ) + // // { + + // // // [🐞] + // // // ### NOTE: + // // // ### It appears, the 'outputChunk.filename' is of type: + // // // ### - _app/immutable/chunks/index.088b98a6.js + // // // ### - _app/immutable/chunks/index.8e8ca4ce.js + // // // ### etc. + // // // console.log(outputChunk.fileName); + + // // return outputChunk.fileName == 'index.js'; + // // } + + // // ### NOTE: + // // ### definitive 'hack' solution for 'single CSS file' output chunk. + // injectCode: + // ( + // cssCode, + // options + // ): string => + // { + + // const generateOneCssFile: boolean = false; + + // if (generateOneCssFile) + // { + // // ### NOTE: + // // ### the 'cssCode' generated contains some 'formatting' issues. + // // ### remove 1st and last speech marks. + // // ### remove cases of `\n` chars. + // // ### correct custom case of 'ids'/'classes' using the 'forward-slash' in the declaration. + // let cssCodeMod: string = cssCode.slice(1, -1); + // cssCodeMod = cssCodeMod.replace(/\\n/g, ""); + // cssCodeMod = cssCodeMod.replace(/\\\\/g,"\\") + + // // ### WARNING: + // // ### 'all-css-chunk.css' must exist inside '/static' + // fs.writeFile + // ( + // './static/all-css-chunk.css', + // cssCodeMod, + // err => + // { + // if (err) console.error(err); + // } + // ); + // } + + // return ''; + + // // return `try{if(typeof document != 'undefined'){var elementStyle = document.createElement('style');elementStyle.appendChild(document.createTextNode(${cssCode}));document.head.appendChild(elementStyle);}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}` + // } + + // } + // ), ], // DOC: REF: [6] - build: { - rollupOptions: - { - output: - { - manualChunks: undefined - } - } - }, + // build: { + // rollupOptions: + // { + // output: + // { + // manualChunks: undefined + // } + // } + // }, // ### NOTE: // ### 'vitest' integration