Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译后按需加载的代码语句,顺序发生变化。 #239

Open
jamieYou opened this issue May 24, 2018 · 6 comments
Open

编译后按需加载的代码语句,顺序发生变化。 #239

jamieYou opened this issue May 24, 2018 · 6 comments

Comments

@jamieYou
Copy link

这是源码

import 'babel-polyfill'
import React from 'react'
import ReactDOM from 'react-dom'
import { LocaleProvider } from 'antd'

使用babel编译后

import 'antd/lib/locale-provider/style';
import _LocaleProvider from 'antd/lib/locale-provider';
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';

本来按源码的顺序,应该是先 import 'babel-polyfill',再 import React 的。
但是编译后,变成 import _LocaleProvider from 'antd/lib/locale-provider' 先(即先加载 react),再加载 babel-polyfill。在低版本浏览器,由于垫片没有生效前就加载了 react,导致出现兼容问题。

@yesmeck
Copy link
Contributor

yesmeck commented Jun 14, 2018

Could you provide a minimal reproduce repo?

@jamieYou
Copy link
Author

@yesmeck
Copy link
Contributor

yesmeck commented Jun 14, 2018

@jamieYou 能 push 到 GitHub 吗,不要压缩。

@jamieYou
Copy link
Author

@yesmeck 抱歉,家里网络慢。
https://github.com/jamieYou/babel-plugin-import-test

@tingtien
Copy link

Waiting for solving

yesmeck added a commit that referenced this issue Nov 4, 2020
Close

- #245
- #420
- #423
- #344
- #342
- #432
- #436
- #331
- #324
- #311
- #297
- #296
- #286
- #282
- #280
- #239
- #172
@yesmeck yesmeck mentioned this issue Nov 4, 2020
yesmeck added a commit that referenced this issue Nov 4, 2020
Close

- #245
- #420
- #423
- #344
- #342
- #432
- #436
- #331
- #324
- #311
- #297
- #296
- #286
- #282
- #280
- #239
- #172
@yoyo837
Copy link

yoyo837 commented Feb 19, 2021

#423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants