Skip to content

Commit b306d8d

Browse files
committed
updated typedef
1 parent 745e96c commit b306d8d

File tree

2 files changed

+79
-4
lines changed

2 files changed

+79
-4
lines changed

lib/bin_build/bin-vite.config.mjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
})

vite.config.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
*/
44
// Utilities
55
import { defineConfig } from 'vite'
6+
67
import { fileURLToPath, URL } from 'node:url'
78
// import { resolve } from 'node:path'
89
// https://vitejs.dev/config/
9-
export default defineConfig({
10+
/**
11+
* @typedef {import('vite').UserConfigExport} UserConfigExport
12+
*/
13+
/**
14+
* @type {UserConfigExport}
15+
*/
16+
export const viteBaseConfig = {
1017
define: { 'process.env': {} },
1118
resolve: {
1219
alias: {
@@ -35,9 +42,9 @@ export default defineConfig({
3542
formats: ['es', 'cjs'],//('es' | 'cjs' | 'umd' | 'iife')
3643
//i lost my jsdocs though... weird
3744
entry: [ //"entry" can be a dictionary or array of multiple entry points
38-
// fileURLToPath(new URL('./src/index.mjs', import.meta.url)),
45+
fileURLToPath(new URL('./src/index.mjs', import.meta.url)),
3946
// fileURLToPath(new URL('./src/win32ToWin32WSL/win32ToWin32WSL2.mjs', import.meta.url)),
40-
fileURLToPath(new URL('./temp/toWsl.mjs', import.meta.url)),
47+
// fileURLToPath(new URL('./temp/toWsl.mjs', import.meta.url)),
4148
// fileURLToPath(new URL('./src/cli/index.mjs', import.meta.url)),
4249
// fileURLToPath(new URL('./dev/node-fs-utils-dev/create-dummy-files.mjs
4350
// ', import.meta.url)),
@@ -64,4 +71,5 @@ export default defineConfig({
6471
},
6572
},
6673

67-
})
74+
}
75+
export default defineConfig(viteBaseConfig)

0 commit comments

Comments
 (0)