ClarkXia

ClarkXia

Front-end developer

Member Since 8 years ago

@Alibaba, hangzhou

Experience Points
18
follower
Lessons Completed
25
follow
Lessons Completed
84
stars
Best Reply Awards
37
repos

1571 contributions in the last year

Pinned
⚡ 🚀 The Progressive Framework Based On React(基于 React 的渐进式研发框架)
⚡ :tiger: Micro Frontends solution for large application(面向大型应用的微前端解决方案),站点国内镜像:https://icestark.gitee.io
⚡ 基于 icejs+fusion 的官方精品物料
⚡ :octopus: 基于 Webpack 的插件化工程构建工具,支持快速建设一套开箱即用的工程方案。
Activity
Nov
26
2 days ago
pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

tests/format routes

  • tests: format routes
pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
Activity icon
delete

ClarkXia in alibaba-fusion/materials delete branch feat-default-lazy

deleted time in 2 days ago
open pull request

ClarkXia wants to merge alibaba/ice

ClarkXia
ClarkXia

tests/format routes

  • tests: format routes
ClarkXia
ClarkXia

这里的缩进为什么变四个空格了

pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

tests/format routes

  • tests: format routes
pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

tests/format routes

  • tests: format routes
open pull request

ClarkXia wants to merge alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
ClarkXia
ClarkXia

这个包应该是 link 的

open pull request

ClarkXia wants to merge alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
ClarkXia
ClarkXia

config.entryPoints. entries() 应该可以吧?不建议全量转化,通过 API 方式获取也不需要强制指定类型 会更合理

open pull request

ClarkXia wants to merge alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
ClarkXia
ClarkXia

源码使用上是写的 input

open pull request

ClarkXia wants to merge alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
ClarkXia
ClarkXia

entryFiles ? 这个逻辑应该跟 htmlPlugin 的 input 输入一致,添加到 html 中的入口应该就是需要添加生命周期的入口,看下是否可以优化

pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
pull request

ClarkXia merge to alibaba/ice

ClarkXia
ClarkXia

feat: 🎸 use `vite-plugin-index-html` as a substitute in Vite mode

  • use vite-plugin-index-html as a substitute in Vite mode
Nov
25
3 days ago
Activity icon
issue

ClarkXia issue alibaba/ice

ClarkXia
ClarkXia

配置 devServer 的 historyApiFallback 失效

问题

在build.json 中配置 devServer.historyApiFallback 失效,其他配置项可以正常 work

原因

plugin-router 插件中强制修改了 historyApiFallback 为 true 代码

应该根据 historyApiFallback 的默认值判断后在确定需不需要进行处理

Activity icon
issue

ClarkXia issue comment alibaba/ice

ClarkXia
ClarkXia

vite 模式下 mock 数据请求失败

mock 文件通过 k-v 形式定义接口返回:

const status = 'SUCCESS';
// mock/index.js
export default {
  'GET /api/repo': {
    status,
    data: {
      group: 'ice.js',
      url: 'http://github.com/ice-lab/ice.js'
    }
  },
};

在 vite 模式下通过 /api/repo 请求可以正常返回,但是如果在 url 上添加 query,比如/api/repo?test=1 则请求失败

Activity icon
issue

ClarkXia issue alibaba/ice

ClarkXia
ClarkXia

vite 模式下 mock 数据请求失败

mock 文件通过 k-v 形式定义接口返回:

const status = 'SUCCESS';
// mock/index.js
export default {
  'GET /api/repo': {
    status,
    data: {
      group: 'ice.js',
      url: 'http://github.com/ice-lab/ice.js'
    }
  },
};

在 vite 模式下通过 /api/repo 请求可以正常返回,但是如果在 url 上添加 query,比如/api/repo?test=1 则请求失败

Activity icon
issue

ClarkXia issue alibaba/ice

ClarkXia
ClarkXia

禁用运行时模式后,多页应用构建报错

What is the current behavior? 发生了什么?

如果禁用了运行时,就不会加载app-core,从而不会执行setRegisterMethod,会导致其他插件里面applyMethod方法为空而报错

image

What is the expected behavior? 期望的结果是什么?

禁用运行时后可以正常构建

Activity icon
issue

ClarkXia issue alibaba/ice

ClarkXia
ClarkXia

更新 build.config.js 的配置不起作用,之前的配置被缓存起来了

What is the current behavior? 发生了什么:

从2.1.0 更新到2.2.2 后发现,更新 build.config.js 的配置不起作用,之前的配置被缓存起来了. 步骤: 把配置中 ['import', { libraryName: 'antd-mobile', libraryDirectory: 'es/components', style:'css' }], 我把style 改成‘css’ 会报错,这个正常 因为 路径不对, 然后我重新改回 style: false(这样配置是正确的),还是会报错,说找不到模块。

What is the expected behavior? 期望的结果:

改配置后,配置能立马生效

Any additional comments? 相关环境信息?

  • ice.js Version:2.2.2
  • build.json Configuration
/*
 * @Author: Hughie
 * @Date: 2021-01-05 15:27:20
 * @LastEditors: Hughie
 * @LastEditTime: 2021-07-23 10:45:40
 * @Description:
 */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
// const packConfig = require('./package.json')
const moment = require('moment')
// const webpack = require('webpack')
// const FileManagerPlugin = require('filemanager-webpack-plugin')

// 环境变量的版本号不能带有.,否则全部转为_
let Version = process.env.Version || 'last'
// const ENV = process.env.ENV || 'Production' // 环境

Version = `${Version.replace(/[./]/g, '_')}_${moment().format('YYYYMMDDHHmmss')}`

// 版本号,去掉origin/,commit显示8位
// const RELEASE = Version

module.exports = {
  disableRuntime: true,
  eslint: false,
  // entry: 'src/index.tsx',
  entry: {
    index: 'src/index.tsx',
  },
  alias: {
    variables: path.resolve(__dirname, './src/style/variables.less'), // support import in less; example in less file: @import '~variable';
    /**
     * ref: https://github.com/gaearon/react-hot-loader#hot-loaderreact-dom
     * @hot-loader/react-dom replaces the 'react-dom' package of the same version, but with additional patches to support hot reloading.
     */
    // 'react-dom': '@hot-loader/react-dom',
    '@': path.resolve(__dirname, './src'),
    types: path.resolve(__dirname, './src/common/types'),
  },
  customWebpack: true,
  plugins: [
    [
      'build-plugin-moment-locales',
      {
        locales: ['zh-cn'],
      },
    ],
    [
      './build.plugin.js',
      {
        Version,
      },
    ],
  ],
  babelPlugins: [
    [
      'const-enum',
      {
        transform: 'constObject',
      },
    ],
    ['import', { libraryName: 'antd-mobile', libraryDirectory: 'es/components', style: false }],
  ],
  extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.html'],
  outputDir: `build/${Version}/`,
  publicPath: `/${Version}/`,
  devServer: {
    historyApiFallback: {
      disableDotRule: true,
      // rewrites: [{ from: /^\/login/, to: '/login.html' }],
    },
  },
  postcssOptions: {
    plugins: {
      'postcss-pxtorem': {
        rootValue: 37.5,
        unitPrecision: 3,
        propList: ['*'],
        minPixelValue: 1,
        exclude: /node_modules/i,
      },
    },
  },
  proxy: {
    '/api': {
      target: 'http://fe00-183-62-98-34.ngrok.io',
      enable: true,
      changeOrigin: true,
    },
  },
}

  • Node Version:6
  • Platform: web
Activity icon
published release v2.2.3

ClarkXia in alibaba/ice create published release v2.2.3

createdAt 3 days ago
Activity icon
created tag

ClarkXia in alibaba/ice create tag v2.2.3

createdAt 3 days ago
push

ClarkXia push alibaba/ice

ClarkXia
ClarkXia

fix: miniapp render (#4867)

  • fix: miniapp render

  • fix: type define

ClarkXia
ClarkXia

Merge branch 'master' into release-next

ClarkXia
ClarkXia

fix: mpa tabbar render (#4957)

  • fix: mpa tabbar render

  • fix: bug

ClarkXia
ClarkXia

chore: add changelog of @builder/mpa-config (#4965)

ClarkXia
ClarkXia

fix: support config devServer.historyApiFallback (#4963)

ClarkXia
ClarkXia

fix: compatible with disable runtime when config mpa (#4961)

ClarkXia
ClarkXia

fix: match the correct pathname of mock server (#4960)

ClarkXia
ClarkXia

fix: compatible with special chars in html (#4962)

ClarkXia
ClarkXia

fix: re-calculate webpack cache id when config disableRuntime (#4972)

ClarkXia
ClarkXia

Merge pull request #4964 from alibaba/release-next

release/2.2.3

commit sha: 6e979ba61cb1f4d0402f97dd5c8f0598384b3d34

push time in 3 days ago
pull request

ClarkXia pull request alibaba/ice

ClarkXia
ClarkXia

release/2.2.3

  • fix: support config devServer.historyApiFallback #4963
  • fix: compatible with special chars in html #4962
  • fix: compatible with disable runtime when config mpa #4961
  • fix: match the correct pathname of mock server #4960
  • fix: re-calculate webpack cache id when config disableRuntime #4972
  • fix: refactor miniapp page component #4867
  • fix: TabBar resolve path and remove jsx+ for TabBar render #4957
push

ClarkXia push alibaba/ice

ClarkXia
ClarkXia

fix: re-calculate webpack cache id when config disableRuntime (#4972)

commit sha: a0138298ce00798216c05a62809a0ae23d5daca3

push time in 3 days ago
Activity icon
delete

ClarkXia in alibaba/ice delete branch fix-cache-id

deleted time in 3 days ago
pull request

ClarkXia pull request alibaba/ice

ClarkXia
ClarkXia

fix: re-calculate webpack cache id when config disableRuntime

Fix #4971

pull request

ClarkXia pull request alibaba/ice

ClarkXia
ClarkXia

fix: re-calculate webpack cache id when config disableRuntime

Fix #4971

Activity icon
created branch

ClarkXia in alibaba/ice create branch fix-cache-id

createdAt 3 days ago
Activity icon
issue

ClarkXia issue comment alibaba/ice

ClarkXia
ClarkXia

更新 build.config.js 的配置不起作用,之前的配置被缓存起来了

What is the current behavior? 发生了什么:

从2.1.0 更新到2.2.2 后发现,更新 build.config.js 的配置不起作用,之前的配置被缓存起来了. 步骤: 把配置中 ['import', { libraryName: 'antd-mobile', libraryDirectory: 'es/components', style:'css' }], 我把style 改成‘css’ 会报错,这个正常 因为 路径不对, 然后我重新改回 style: false(这样配置是正确的),还是会报错,说找不到模块。

What is the expected behavior? 期望的结果:

改配置后,配置能立马生效

Any additional comments? 相关环境信息?

  • ice.js Version:2.2.2
  • build.json Configuration
/*
 * @Author: Hughie
 * @Date: 2021-01-05 15:27:20
 * @LastEditors: Hughie
 * @LastEditTime: 2021-07-23 10:45:40
 * @Description:
 */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
// const packConfig = require('./package.json')
const moment = require('moment')
// const webpack = require('webpack')
// const FileManagerPlugin = require('filemanager-webpack-plugin')

// 环境变量的版本号不能带有.,否则全部转为_
let Version = process.env.Version || 'last'
// const ENV = process.env.ENV || 'Production' // 环境

Version = `${Version.replace(/[./]/g, '_')}_${moment().format('YYYYMMDDHHmmss')}`

// 版本号,去掉origin/,commit显示8位
// const RELEASE = Version

module.exports = {
  disableRuntime: true,
  eslint: false,
  // entry: 'src/index.tsx',
  entry: {
    index: 'src/index.tsx',
  },
  alias: {
    variables: path.resolve(__dirname, './src/style/variables.less'), // support import in less; example in less file: @import '~variable';
    /**
     * ref: https://github.com/gaearon/react-hot-loader#hot-loaderreact-dom
     * @hot-loader/react-dom replaces the 'react-dom' package of the same version, but with additional patches to support hot reloading.
     */
    // 'react-dom': '@hot-loader/react-dom',
    '@': path.resolve(__dirname, './src'),
    types: path.resolve(__dirname, './src/common/types'),
  },
  customWebpack: true,
  plugins: [
    [
      'build-plugin-moment-locales',
      {
        locales: ['zh-cn'],
      },
    ],
    [
      './build.plugin.js',
      {
        Version,
      },
    ],
  ],
  babelPlugins: [
    [
      'const-enum',
      {
        transform: 'constObject',
      },
    ],
    ['import', { libraryName: 'antd-mobile', libraryDirectory: 'es/components', style: false }],
  ],
  extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.html'],
  outputDir: `build/${Version}/`,
  publicPath: `/${Version}/`,
  devServer: {
    historyApiFallback: {
      disableDotRule: true,
      // rewrites: [{ from: /^\/login/, to: '/login.html' }],
    },
  },
  postcssOptions: {
    plugins: {
      'postcss-pxtorem': {
        rootValue: 37.5,
        unitPrecision: 3,
        propList: ['*'],
        minPixelValue: 1,
        exclude: /node_modules/i,
      },
    },
  },
  proxy: {
    '/api': {
      target: 'http://fe00-183-62-98-34.ngrok.io',
      enable: true,
      changeOrigin: true,
    },
  },
}

  • Node Version:6
  • Platform: web
ClarkXia
ClarkXia

icejs 会根据配置计算 cache id https://github.com/alibaba/ice/blob/f9ab033ead0e0ac2ead135e4e615ec163a984693/packages/plugin-app-core/src/index.ts#L41

由于开启了 disableRuntime 导致 app-core 的插件未被使用,cache id 无法更新

Previous