build(widget): 为 Vite 配置添加 IIFE 格式并自定义输出文件名
调整 lib 输出配置,新增 'iife' 格式以支持更广泛的浏览器环境直接使用。 同时自定义各格式的输出文件名,使 ES 和 UMD 格式的文件名更清晰,并将 IIFE 格式作为默认的 'cwd.js' 文件。
This commit is contained in:
@@ -40,8 +40,12 @@ export default defineConfig({
|
|||||||
lib: {
|
lib: {
|
||||||
name: 'CWDComments',
|
name: 'CWDComments',
|
||||||
entry: resolve(__dirname, 'src/index.js'),
|
entry: resolve(__dirname, 'src/index.js'),
|
||||||
formats: ['es', 'umd'],
|
formats: ['es', 'umd', 'iife'],
|
||||||
fileName: (format) => `cwd.${format}.js`,
|
fileName: (format) => {
|
||||||
|
if (format === 'es') return 'cwd.es.js';
|
||||||
|
if (format === 'umd') return 'cwd.umd.js';
|
||||||
|
return 'cwd.js';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
|
|||||||
Reference in New Issue
Block a user