Function
buildFile
({
name,
input,
output,
minify,
isCss,
outDir,
}: {
name?: LibraryOptions['name'];
input: string;
output: string;
outDir: string;
minify: boolean;
isCss: boolean;
})
Source from the content-addressed store, hash-verified
| 85 | } |
| 86 | |
| 87 | async function buildFile({ |
| 88 | name, |
| 89 | input, |
| 90 | output, |
| 91 | minify, |
| 92 | isCss, |
| 93 | outDir, |
| 94 | }: { |
| 95 | name?: LibraryOptions['name']; |
| 96 | input: string; |
| 97 | output: string; |
| 98 | outDir: string; |
| 99 | minify: boolean; |
| 100 | isCss: boolean; |
| 101 | }) { |
| 102 | await build({ |
| 103 | entryPoints: [input], |
| 104 | outfile: output, |
| 105 | minify, |
| 106 | sourcemap: true, |
| 107 | format: isCss ? undefined : ('umd' as Format), |
| 108 | target: isCss ? undefined : 'es2017', |
| 109 | treeShaking: !isCss, |
| 110 | plugins: [ |
| 111 | umdWrapper({ |
| 112 | libraryName: name, |
| 113 | }), |
| 114 | ], |
| 115 | }); |
| 116 | const filename = output.replace( |
| 117 | new RegExp(`^.+[/\\\\](${outDir}[/\\\\])`), |
| 118 | '$1', |
| 119 | ); |
| 120 | console.log(filename); |
| 121 | console.log(`${filename}.map`); |
| 122 | } |
| 123 | |
| 124 | export default function ( |
| 125 | entry: LibraryOptions['entry'], |
Tested by
no test coverage detected