|
| 1 | +/** |
| 2 | + * Bin builder for vite config |
| 3 | + */ |
| 4 | +// Utilities |
| 5 | +import { defineConfig } from 'vite' |
| 6 | +import { fileURLToPath, URL } from 'node:url' |
| 7 | +// import { resolve } from 'node:path' |
| 8 | +// https://vitejs.dev/config/ |
| 9 | +export default defineConfig({ |
| 10 | + define: { 'process.env': {} }, |
| 11 | + resolve: { |
| 12 | + alias: { |
| 13 | + // https://vitejs.dev/config/shared-options.html#resolve-alias |
| 14 | + //https://nodejs.dev/en/api/v18/packages/#subpath-imports |
| 15 | + '##': fileURLToPath(new URL('./',import.meta.url)),//might want to try # or @ again |
| 16 | + '#src': fileURLToPath(new URL('./src', import.meta.url)), |
| 17 | + '#docs': fileURLToPath(new URL('./docs', import.meta.url)),//not sure if vite also needs this but yea |
| 18 | + }, |
| 19 | + extensions: [ |
| 20 | + '.js', |
| 21 | + '.json', |
| 22 | + '.mjs', |
| 23 | + '.vue', |
| 24 | + ], |
| 25 | + }, |
| 26 | + /** |
| 27 | + * For experimentation of puppeteer |
| 28 | + */ |
| 29 | + build: { |
| 30 | + //https://vitejs.dev/guide/build.html#library-mode |
| 31 | + outDir: fileURLToPath(new URL('./lib/dist/', import.meta.url)), |
| 32 | + lib: { |
| 33 | + name: 'nuxt3-win32-posix-path', |
| 34 | + // formats: ['es', 'cjs','umd'],//('es' | 'cjs' | 'umd' | 'iife') |
| 35 | + formats: ['es', 'cjs'],//('es' | 'cjs' | 'umd' | 'iife') |
| 36 | + //i lost my jsdocs though... weird |
| 37 | + entry: [ //"entry" can be a dictionary or array of multiple entry points |
| 38 | + // fileURLToPath(new URL('./src/index.mjs', import.meta.url)), |
| 39 | + fileURLToPath(new URL('./src/win32ToWin32WSL/win32ToWin32WSL2.mjs', import.meta.url)), |
| 40 | + // fileURLToPath(new URL('./temp/toWsl.mjs', import.meta.url)), |
| 41 | + // fileURLToPath(new URL('./src/cli/index.mjs', import.meta.url)), |
| 42 | + // fileURLToPath(new URL('./dev/node-fs-utils-dev/create-dummy-files.mjs |
| 43 | + // ', import.meta.url)), |
| 44 | + // fileURLToPath(new URL('./src/win32ToWin32WSL2.mjs', import.meta.url)), |
| 45 | + // fileURLToPath(new URL('./src/import-material-theme-pup.mjs', import.meta.url)), |
| 46 | + // resolve('src/import-theme-chrome-pup.mjs'), |
| 47 | + // Ok... cannot use vite to roll it up... just doesnt work |
| 48 | + // resolve('##/src/generate-pupp-json/generate-pupp-json.mjs'),//fixme, this path didnt work? |
| 49 | + // fileURLToPath(new URL('./src/generate-pupp-json/generate-pupp-json.mjs', import.meta.url)), |
| 50 | + // resolve('##/src/index.mjs'), |
| 51 | + ] |
| 52 | + }, |
| 53 | + rollupOptions: { |
| 54 | + // make sure to externalize deps that shouldn't be bundled |
| 55 | + // into your library |
| 56 | + // external: ['puppeteer',"puppeteer-core","node:path/posix","node*"], |
| 57 | + output: { |
| 58 | + // Provide global variables to use in the UMD build |
| 59 | + // for externalized deps |
| 60 | + // globals: { |
| 61 | + // vue: 'Vue',//not sure what this means |
| 62 | + // }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + }, |
| 66 | + |
| 67 | +}) |
0 commit comments