Created a project. in pacakge.json indicated the following dependencies:
"scripts": { "start": "gulp" }, "browserify": { "transform": [ [ "babelify", { "presets": [ "es2015", "react" ] } ] ] }, "private": true, "devDependencies": { "babel-core": "^6.17.0", "babel-loader": "^6.2.5", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", "babelify": "^7.2.0", "browser-sync": "^2.11.0", "browserify": "^13.0.0", "gulp": "^3.9.1", "gulp-notify": "^2.2.0", "gulp-util": "^3.0.1", "gulp-webserver": "~0.9.1", "pretty-hrtime": "^1.0.1", "require-dir": "^0.3.0", "underscore": "^1.8.3", "vinyl-source-stream": "^1.0.0", "watchify": "^3.6.1" }, "dependencies": { "bootstrap": "^3.3.6", "es6-promise": "^3.2.1", "gulp-autoprefixer": "^3.1.0", "gulp-clean-css": "^2.0.11", "gulp-concat": "^2.6.0", "gulp-minify-css": "^1.2.4", "react": "^15.0.1", "react-addons-css-transition-group": "~15.3.1", "react-bootstrap": "^0.30.0-rc.2", "react-bootstrap-datetimepicker": "0.0.22", "react-bootstrap-table": "^2.3.8", "react-breadcrumbs": "^1.3.16", "react-dom": "^15.0.1", "react-notifications": "~1.3.0", "react-router": "^2.8.1", "react-tap-event-plugin": "^1.0.0" } gulpfile:
var babelify = require('babelify'); require('es6-promise').polyfill(); var requireDir = require('require-dir'); requireDir('./gulp/tasks', { recurse: true }); gulp-config:
var dest = './build', src = './src'; module.exports = { browserSync: { server: { // We're serving the src folder as well // for sass sourcemap linking baseDir: [dest, src] }, files: [ dest + '/**' ] }, markup: { src: src + "/frontend/**", dest: dest }, browserify: { // Enable source maps debug: true, // A separate bundle will be generated for each // bundle config in the list below bundleConfigs: [{ entries: src + '/frontend/js/app.js', dest: dest, outputName: 'app.js' }], extensions: ['.js'], } }; There is a code for the component:
import React from 'react'; import {Router, Route, IndexRoute, Link, hashHistory} from 'react-router' import {Component} from 'react' import {render} from 'react-dom' import Home from './Home'; import {NotificationContainer, NotificationManager} from 'react-notifications'; const App = React.createClass({ render: function() { return ( <div className="row"> <div className="row"> <b>Hello I'am reaaact!</b> </div> <div className='app-container'> <hr/> {this.props.children} </div> </div> ) } }); render((<Router history={hashHistory}> <Route path="/" component={App}> <IndexRoute component={Home}/> </Route> </Router> ), document.getElementById('app')); I collect with the npm start command, gulp collects everything fine, but when launched in the browser it swears at imports. there is a node_modules folder with installed react-modules, however, there is a feeling that he does not see them and cannot import the necessary components of the react-library. how to solve this problem?