Giter Site home page Giter Site logo

umi3-demo's Introduction

umi3-demo

What happens?

问题:项目中使用了 Umi3,尝试从 umi 中引入 useLocation 并在组件中使用后,发现,在开发环境中,会自动引入 webpack:///./node_modules/antd/es/style/index.less,同一代码在生产环境中,是不会引入的,存在样式差异。

  • 开发环境: dev
  • 生产环境: prod

困惑:不确定这是 feature 还是 bug,或者是本人使用方式不对,求解惑,很喜欢 Umi,非常感谢。

最小可复现仓库

请使用 yarn create @umijs/umi-app 创建,并上传到你的 GitHub 仓库

https://github.com/JophielZX/umi3-demo

复现步骤,错误日志以及相关配置

  1. 使用 yarn create @umijs/umi-app 初始化项目

  2. 修改 src/pages/index.tsx 文件,如下:

    import React from 'react';
    import { useLocation } from 'umi';
    import styles from './index.less';
    
    export default () => {
      const { pathname } = useLocation();
    
      return (
        <div>
          <h1 className={styles.title}>Page index</h1>
          <div>pathname: {pathname}</div>
        </div>
      );
    };
  3. 执行 yarn start 查看开发环境样式

  4. 执行 yarn build,而后 serve dist,查看生产环境样式

相关环境信息

  • Yarn 版本:1.22.4
  • Umi 版本:3.0.11
  • Node 版本:v12.16.1
  • 操作系统:Win10

umi3-demo's People

Contributors

jophielzx avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.