【发布时间】:2018-06-08 08:03:27
【问题描述】:
我正在开发一个网站并尝试包含一个 ReactJS 组件,我正在这样做:
import React from "react";
import ReactDOM from "react-dom";
import Layout from "Layout.jsx";
const app = angular.module('myApp');
const reactDirective = app.directive('reactDirective', function() {
return {
template: '<div id="reactapp"></div>',
link: function(scope, el, attrs){
ReactDOM.render(<Layout/>, document.getElementById('reactapp'));
}
}
});
和 Layout.jsx
import React from 'react';
export default class Layout extends React.Component {
constructor(props){
super(props);
}
render() {
return (
<div>
This is ReactJS
</div>
);
}
}
但是,无论何时编译,它都会给我ERROR in ./react-app.js
Module not found: Error: Cannot resolve module 'layout.jsx'
谁能告诉我我的代码有什么问题?
【问题讨论】: