1

When running npm build with:

"build": "browserify -t [ babelify --presets [ es2015 react ] ] app/assets/app.jsx -o public/javascripts/app.js"

I am getting following error:

Error: Cannot find module 'components/maininput.jsx' from 'C:\Users\Work\Documents\NetBeansProjects\Project\app\assets'

Project structure looks like this:

app
|
└────assets
    │   app.jsx
    |
    └───components 
           maininput.jsx

import in app.jsx looks like this:

import React from 'react';
import ReactDOM from 'react-dom';
import { MainInput } from '../components/maininput.jsx'

export in maininput.jsx looks like this:

export default class MainInput extends React.Component {
  //some code and render()
}

I also created GulpFile and also there getting same error:

{ Error: Cannot find module '../components/maininput.jsx'

EDIT: I have found out that it is working only if I provide full path to component, which is strange. Anyone knows what might cause this problem? Probably some enviroment variable or ?

1 Answer 1

2

Use ./ at the beginning of your import path:

import { MainInput } from './components/maininput.jsx'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.