Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

[BUG]编译错误 'import' and 'export' may only appear at the top level #794

Closed
ysc123 opened this issue Apr 14, 2020 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@ysc123
Copy link

ysc123 commented Apr 14, 2020

bug 描述
编译的时候后报错

复现步骤
用的examples里面 redux 的demo,添加babel-preset-remax后,编译报错。

复现代码
(63): node_modules/react-reconciler/index.js
[babel]: /Users/mindasset/workspace/qdhk/Remax/remax-qdhk/node_modules/symbol-observable/es/index.js: 'import' and 'export' may only appear at the top level (5:0)
var es = commonjsHelpers.createCommonjsModule(function (module) {
/* global window */
import ponyfill from './ponyfill.js';
var root;

版本信息:

  • remax 版本: [e.g. 1.9.0]

其他信息

@ysc123 ysc123 added the bug Something isn't working label Apr 14, 2020
@yesmeck
Copy link
Member

yesmeck commented Apr 14, 2020

这个其实是 @rollup/plugin-commonjs 的 bug

临时的方案时先用旧版本的 Remax,试试 1.10.7

@ysc123
Copy link
Author

ysc123 commented Apr 14, 2020

退回了 1.9.0 版本 ,没问题了!

@ysc123 ysc123 closed this as completed Apr 14, 2020
@yesmeck yesmeck reopened this Apr 14, 2020
@yesmeck
Copy link
Member

yesmeck commented Apr 14, 2020

先开着吧,等 @rollup/plugin-commonjs 修复了可以再升级上来。

@ysc123
Copy link
Author

ysc123 commented Apr 14, 2020

@yesmeck ok

@yesmeck
Copy link
Member

yesmeck commented Apr 16, 2020

临时解决方法,在 package.json 里加上:

{
  "resolutions": {
    "@rollup/plugin-commonjs": "11.0.2"
  }
}

然后重装下依赖。

@yesmeck yesmeck changed the title [BUG]添加babel-preset-remax": "^1.20.0" ,支持bind:after-enter时,编译报错 [BUG]编译错误 'import' and 'export' may only appear at the top level Apr 16, 2020
@yesmeck
Copy link
Member

yesmeck commented May 6, 2020

2.0 里不会有这个问题了。

@yesmeck yesmeck closed this as completed May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants