Web kutusunun çalışması bile Chrome Canary'den aşağıdaki hatayla karşılaşıyorum. Bu arada "Ana" Benim bileşeni ile oluşturulan Tepki 0.14.6Yakalanmamış ReferenceError: Ana, raylar için web paketi/reaktifi ile tanımlanmamıştır. 4.2.4
VM601:1 Uncaught ReferenceError: Main is not defined
(anonymous function) @ VM601:1
mountComponents @ react_ujs_mount.self-69e74f4….js?body=1:56
(anonymous function) @ react_ujs_native.self-69da92a….js?body=1:9
fire @ jquery.self-660adc5….js?body=1:3233
fireWith @ jquery.self-660adc5….js?body=1:3363
ready @ jquery.self-660adc5….js?body=1:3583
completed @ jquery.self-660adc5….js?body=1:3618
Ben yüklemek veya başka bir şey kurmak gerekirse biliyor musunuz? Aşağıda
, sen benim OS X Yosemite 10.10.5
WebPack ben benim test uygulaması açıkken "WebPack" çalıştırdığınızda
i got mesajı var kurulum ve konfigürasyon bulabilirsiniz altında. İyi gözüküyor gibi görünüyor. Benim babel Yükleme sırasında
ash: f9147c799d98d76fbd61
Version: webpack 1.12.14
Time: 624ms
Asset Size Chunks Chunk Names
bundle.js 5.76 kB 0 [emitted] main
+ 2 hidden modules
Babel kurulum
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] extraneous
[email protected] extraneous
[email protected] extraneous
i aşağıda mesajı aldı. Ben
webpack
babel-loader
babel-preset-es2015
babel-preset-react
babel-preset-stage-0
babel loader through
başka soru
yüklerken açılannpm ERR! peer dep missing: [email protected] || ^2.1.0-beta, required by babel
[email protected]
.
Bunun paketin oluşumunu etkileyip etkilemeyeceğini biliyor musunuz?
.babelrc
{
"presets": ["es2015", "stage-0", "react"]
}
webpack.config.js
module.exports = {
entry: "./app/assets/frontend/main.jsx",
output: {
path: __dirname + "/app/assets/javascripts",
filename: "bundle.js"
},
resolve: {
extensions: ['','.js','.jsx']
},
module: {
loaders: [
{ test: /\.jsx$/, loader: "babel-loader" }
]
}
};
greet.jsx
export default class Greet extends React.Component {
render() {
return <h2>Hello World</h2>;
}
}
import Greet from './greet';
class Main extends React.Component {
render() {
return (
<Greet />
);
}
}
let documentReady =() => {
ReactDOM.render(
<Main />,
document.getElementById('react')
);
};
$(documentReady);
index.html.erb
<div id="react"/>
<%= react_component("Main") %>
package.json Hemen cevap için
{
"name": "twitter-clone",
"version": "1.0.0",
"description": "Twitter clone, written in React, Flux, and Rails",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jose Alanya",
"license": "ISC",
"dependencies": {
"babel-core": "^6.7.4",
"babel-loader": "^6.2.4"
},
"devDependencies": {
"babel-core": "^6.7.4",
"babel-loader": "^6.2.4"
}
}
teşekkürler main.jsx.
Teşekkür aarkerio:
kutudan çıktığı WebPack destekleyen başka mücevher yoktur. Bu yapılandırmayı ekledim ve bu satırı ekledim.Main = Main; Samer Buna tarafından gönderildi. Şimdi çalışıyor. Howerver, bu blok kodu sökücü zorunda: izin documentReady =() => { ReactDOM.render ( , Document.getElementById ('tepki') ); }; $ (documentReady); –