ice icon indicating copy to clipboard operation
ice copied to clipboard

assets-manifest.json 生成相关错误

Open YSMJ1994 opened this issue 1 year ago • 3 comments

Describe the bug

错误1: 当插件配置多任务构建时,两个任务生成的 assets-manifest.json 文件名相同,会相互覆盖,且无法通过配置调整文件名 错误2: 手动在 plugin 内设置 assetsManifest = false,构建报错,错误位置发生在 ServerRunnerPluginServerCompilerPlugin

Expected behavior

  1. 可以手动指定 assets-manifest.json 文件名,或者默认将多任务生成的 manifest 合并起来
  2. 配置 assetsManifest = false 能正常构建

Actual behavior

No response

Version of ice.js

3.5.1

Content of build.json or ice.config.mts

import { defineConfig } from '@ice/app';
import type { Plugin } from '@ice/app/types';
import def from '@ali/ice-plugin-def';

const myPlugin: Plugin = () => {
  return {
    name: 'test',
    setup(api) {
      // 问题1: 多个任务间生成的 assets-manifest.json 相互覆盖
      api.registerTask('custom', {
        entry: {
          custom: './src/pages/index',
        },
      });
      // 问题2: 配置 assetsManifest = false 构建错误
      // api.onGetConfig(config => {
      //   config.assetsManifest = false;
      // });
    },
  };
};

// The project config, see https://v3.ice.work/docs/guide/basic/config
const minify = process.env.NODE_ENV === 'production' ? 'swc' : false;
export default defineConfig(() => ({
  // Set your configs here.
  minify,
  server: {
    onDemand: true,
    format: 'esm',
  },
  plugins: [def(), myPlugin()],
}));

Additional context

No response

YSMJ1994 avatar Dec 10 '24 07:12 YSMJ1994

使用 npm create ice ice-app 新建项目加上上述 ice.config.mts 内容即可复现问题

YSMJ1994 avatar Dec 10 '24 07:12 YSMJ1994

多任务下的确会有这个问题,目前多任务是希望构建那里两端? 理论上 assets-manifest 仅用于 web 产物消费

ClarkXia avatar Dec 18 '24 03:12 ClarkXia

@XXXMrG 多端构建时 考虑下这个 case

ClarkXia avatar Feb 11 '25 02:02 ClarkXia