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

[bug]IE8下import { Component } from 'nervjs'报错 #75

Open
YutHelloWorld opened this issue Jun 4, 2018 · 4 comments
Open

[bug]IE8下import { Component } from 'nervjs'报错 #75

YutHelloWorld opened this issue Jun 4, 2018 · 4 comments

Comments

@YutHelloWorld
Copy link

现象

import Nerv, { Component } from 'nervjs'

class A extends Component {
...
}

Chrome下运行正常,在IE 8下运行P抛错new TypeError('Super expression must either be null or a function') 例外被抛出未接住

一种解决方法:

import Nerv from 'nervjs'

class A extends Nerv.Component {
...
}

请问是否能从Nerv本身层面解决这个问题?

@yuche
Copy link
Contributor

yuche commented Jun 4, 2018

应该是 babel 设置的问题, 把 class-propertiesspec 打开:

// .babelrc
{
  "plugins": [
    ["transform-class-properties", { "spec": true }]
  ]
}

@YutHelloWorld
Copy link
Author

使用https://github.com/NervJS/nerv-webpack-boilerplate.

"plugins": [
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
  ]

不论loose是否打开 IE8都报错

@qqw78901
Copy link

qqw78901 commented Jun 8, 2018

你的component有super了吗 是component创建失败吧

@aiplat
Copy link

aiplat commented Jul 3, 2018

参考 https://github.com/womendi/nervjs-ie8
package.json中build只写webpack就好,不要加--config *.js

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