Giter Site home page Giter Site logo

Comments (5)

yuche avatar yuche commented on May 5, 2024

快速开始的问题

  1. 在.babelrc配置了"pragma": "Nerv.createElement"后

其实 <div class="t" /> 会被编译成 Nerv.createElement('div', { class: 't' })。只要你使用了 JSX,不管是 React 还是 Vue 还是 Nerv 都需要导入一个 JSX 的构造函数。

readme 中的一些问题

  1. es5-polyfill无用

unpkg 的 CDN (https://unpkg.com/es5-polyfill) 可以拿到他的入口文件,说明应该包本身没有问题。不知道你是否混用了 npmcnpm 或者 yarn

  1. .babelrc 配置 preset-es3报错

考虑使用这个模板: https://github.com/NervJS/nerv-webpack-boilerplate

使用过程中

  1. 配合 react-router

希望新开一个 issue,给一个简单的复现,不然我们也不知道具体情况是怎么回事。

from nerv.

wslx520 avatar wslx520 commented on May 5, 2024

es5-polyfill无用纯粹是我require的时候写错了, 写成了 es5-polifill...不好意思 😥

react-router我再确认下, 如果有问题就另提 issue

from nerv.

wslx520 avatar wslx520 commented on May 5, 2024

@yuche 另外, 直接 require('es5-polyfill')后, 在 chrome 和 firefox 下均报错, 错误行位于: polyfill.js 1253

document.head = document.head || document.getElementsByTagName('head')[0]; // HTML Tag shiv

chrome 下报: Uncaught TypeError: Cannot assign to read only property 'head' of object '#'

firefox: TypeError: setting getter-only property "head"

from nerv.

luckyadam avatar luckyadam commented on May 5, 2024

@wslx520 试了一下,不会报错请问chrome/ff的版本是多少

from nerv.

qqw78901 avatar qqw78901 commented on May 5, 2024

`按照教程的配置
import React from 'react'
import ReactDOM from 'react-dom'

class App extends React.Component {
constructor () {
super(...arguments)
this.state = {}
}

render () {
return (



)
}
}

ReactDOM.render(, document.getElementById('app'))
报错Nerv is not defined 而
import Nerv from 'nervjs'

class App extends Nerv.Component {
constructor () {
super(...arguments)
this.state = {}
}

render () {
return (



)
}
}

Nerv.render(, document.getElementById('app'))就不会 alias和babel已经设置了 resolve: {
alias: {
'react': 'nervjs',
'react-dom': 'nervjs'
}, "plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "Nerv.createElement"
}
]
]`

from nerv.

Related Issues (20)

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.