当我不进行代码分割时,为什么 Rollup 会抱怨代码分割?

Lan*_*ino 9 rollup iife typescript code-splitting

output我的只有一项rollup.config.js

export default {
  input: './src/Index.tsx',
  output: {
    dir: './myBundle/bundle',
    format: 'iife',
    sourcemap: true,
  },
  plugins: [
    typescript(),
    nodeResolve(),
    commonjs(),
    babel(),
    json(),
    terser(),
  ],
};
Run Code Online (Sandbox Code Playgroud)

为什么 Rollup 指责我进行代码分割? [!] Error: UMD and IIFE output formats are not supported for code-splitting builds.

loc*_*red 21

使用Routify时遇到这个问题。添加inlineDynamicImports: truerollup.config.js 解决了我的问题

export default {
input: "src/main.ts",
output: {
    sourcemap: true,
    format: "iife",
    name: "app",
    file: "public/build/bundle.js",
    inlineDynamicImports: true, //Add this
},
Run Code Online (Sandbox Code Playgroud)

svelte - 导入依赖包出错