###前提・実現したいこと
jadeをreact向けにコンパイルしたいです。
こちらのモジュールを使用しています。
https://github.com/pugjs/react-jade
###該当のソースコード
package.json
json
1"devDependencies": { 2 "browserify": "^13.1.0", 3 "jade": "^1.11.0", 4 "react": "^15.2.1", 5 "react-jade": "^2.5.0" 6}
index.js
javascript
1var React = require('react'); 2var jade = require('react-jade'); 3 4var template = jade.compileFile(__dirname + '/template.jade'); 5 6React.render(template({local: 'values'}), document.getElementById('container'));
template.jade
jade
1h1(class=foo) 2 | Hello, world!! 3h2 4 | Hello, react-jade!
index.html
html
1<!DOCTYPE html> 2<html> 3 <head> 4 <title>Hello world</title> 5 </head> 6 <body> 7 <div id="container"></div> 8 <script src="./bundle.js"></script> 9 </body> 10</html>
###試したこと
このようなファイル構成で以下のコマンドを実行。
browserify index.js --transform react-jade > bundle.js
出来上がったbundle.jsをindex.htmlで読み込んでみても、
bundle.js:170 Uncaught TypeError: React.render is not a function
となってしまいます。
考えられる原因にどんなものがあるでしょうか?
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/18 14:05