简体   繁体   English

基本的JSPM React样本在加载react-tools / vendor / fbtransform / visitors时失败错误

[英]basic JSPM React sample failing erroring on loading react-tools/vendor/fbtransform/visitors

Trying to get a very basic react/jspm example working over on plnkr.co but it is erroring out with a number of 404's. 试图在plnkr.co上获得一个非常基本的react / jspm示例,但是它出现了多个404错误。 Most notably the following: 最值得注意的是:

Uncaught (in promise) Error: XHR error (404 Not Found) loading https://npm.jspm.io/react-tools@0.13.3/vendor/fbtransform/visitors
    Error loading https://npm.jspm.io/react-tools@0.13.3/vendor/fbtransform/visitors as "./vendor/fbtransform/visitors" from https://npm.jspm.io/react-tools@0.13.3/main.js
    Error loading https://registry.jspm.io/js/app.jsx.js!https://registry.jspm.io/jsx.js
    at r (https://jspm.io/system@0.18.17.js:5:11565)
    at XMLHttpRequest.o.onreadystatechange (https://jspm.io/system@0.18.17.js:5:12090)

Any thoughts on how to get past these and get the sample to render? 关于如何克服这些困难并获得样本进行渲染的任何想法?

--> problem plnkr.co sample here <-- -> 问题plnkr.co示例在这里 <-


The code was also copied in the following code snippet (which obviously will never work here as different JSX files are required) just for SO readers that doesn't want to go to plnkr.co. 该代码还被复制到以下代码段中(显然,由于需要使用不同的JSX文件,该代码段在这里永远无法使用),仅适用于不想访问plnkr.co的SO读者。

 // app.jsx import React from 'react' import Test from './test.jsx!' React.render( <Test /> , document.getElementById('main') ); //------------------------------ // test.jsx import React from 'react' export default React.createClass({ displayName: 'Test' , render: function () { return ( <div>Awesome Test!</div> ) } }) //------------------------------ //config.js System.config({ }); 
 <!-- index.html --> <!DOCTYPE html> <html> <head> </head> <body> <div id="main"></div> <script src="https://jspm.io/system@0.18.17.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('js/app.jsx!jsx') </script> </body> </html> 

You have these problems: 您有以下问题:

  1. index.html: System.import('js/app.jsx!jsx') should have been System.import('./app') index.html: System.import('js/app.jsx!jsx')应该是System.import('./app')

  2. app.jsx: import Test from './test.jsx!' app.jsx: import Test from './test.jsx!' should have been import Test from './test' 应该已经import Test from './test'

  3. Missing map to your libraries in config.js: 缺少映射到config.js中的库的映射:

     System.config({ map: { "react": "npm:react@0.13.3" } }); 

Here is the fixed plunker 这是固定的塞子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM