ice icon indicating copy to clipboard operation
ice copied to clipboard

ice3.0约定式路由首次加载菜单时,css样式缺失

Open LOL871230823 opened this issue 8 months ago • 3 comments

Describe the bug

使用默认约定式路由,首次加载css样式缺失,路由切换后,再次返回正常加载 image image

使用配置式路由,首次可正常加载css样式 image image

image image

Expected behavior

使用约定式路由策略时,可正常加载css资源

Actual behavior

使用默认约定式路由,首次加载css样式缺失,路由切换后,再次返回正常加载 image image

Version of ice.js

3

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,
  hash: 'contenthash',
  plugins: [
    fusion({
    }),
    icestark({ type: 'framework' }),
    store(),
    request(),
  ],
  routes: {
    ignoreFiles: [
      'custom.tsx',
      '**/components/**',   // 如果每个页面下有 components 目录存放当前页面的组件,可以通过添加此配置忽略被解析成路由组件
    ],
    defineRoutes: (route) => {
      route('/', 'home/index.tsx');
    },
    config: []
  },

  webpack: (webpackConfig:any) => {
    webpackConfig.module.rules.push(      {
      test: /\.(mp4|webm|ogg|mp3|wav|avi|mov|flac|aac|mpeg|woff|woff2|eot|ttf|otf)$/i,
      type: 'asset',
      generator: {
        filename: 'assets/[hash][ext][query]',
      },
      parser: {
        dataUrlCondition: {
          maxSize: 10 * 1024, // 小于10KB的文件将被内联为Base64
        },
      },
    },);

    return modifyLoader(webpackConfig, {
      rule: '.less',
      loader: 'less-loader',
      options: (originOptions) => ({
        lessOptions: {
          javascriptEnabled: true, // 正确配置javascriptEnabled的方式
        },
      }),
    });
  },
}));

Additional context

No response

LOL871230823 avatar Jun 21 '24 07:06 LOL871230823