ice icon indicating copy to clipboard operation
ice copied to clipboard

ice3.0通过模板快速创建的主应用无法正常导入二进制文件资源

Open LOL871230823 opened this issue 9 months ago • 5 comments

Describe the bug

npm init ice icestark-framework @icedesign/stark-layout

image image image

Expected behavior

希望可以想图片相关资源一样,可以正常导入

Actual behavior

No response

Version of ice.js

"@ice/app": "^3.0.0",

Content of build.json or ice.config.mts

import { defineConfig } from '@ice/app';
import icestark from '@ice/plugin-icestark';
import fusion from '@ice/plugin-fusion';
import store from '@ice/plugin-store';
import request from '@ice/plugin-request';
import { addLoader, modifyLoader, removeLoader } from '@ice/webpack-modify';
export default defineConfig(() => ({
  ssg: false,
  plugins: [
    fusion({
      themePackage: '@alifd/theme-design-pro',
      theme: {
        'css-prefix': 'next-icestark-',
      },
    }),
    icestark({ type: 'framework' }),
    store(),
    request()
  ],
  webpack: (webpackConfig) => {
    return ['mp3', 'mp4', 'wav'].reduce((acc, cur) => {
      return modifyLoader(acc, {
        rule: `.${cur}`,
        loader: 'url-loader',
        options: (originOptions) => {
          return {
            name: '[name].[ext]', // 输出文件名保持原样
            outputPath: 'assets/audio/', // 输出目录,可选
            publicPath: 'assets/audio/' // 公共路径,如果需要的话
          }
        },
      });
    }, webpackConfig);
  },
}));

Additional context

No response

LOL871230823 avatar May 15 '24 03:05 LOL871230823