vite插件使用tsup打包后引入报错 Error: Dynamic require of "fs" is not supported

参考tsup.config.ts配置

import type { Options } from 'tsup'

export const tsup: Options = {
    splitting: false,
    sourcemap: false,
    clean: true,
    format: ['cjs', 'esm'],
    dts: true,
    entryPoints: [
        'src/index.ts'
    ],
    external: [
        'vite',
        'webpack',
        'rollup',
        'esbuild',
    ],
    define: {
        __DEV__: 'false',
    },
    bundle: true,
    banner: {
        js: 'import { createRequire } from \'module\';const require = createRequire(import.meta.url);'
    },
    platform: "node"
}
posted on 2023-01-03 09:41  是庸  阅读(1980)  评论(0编辑  收藏  举报