1

I am trying to publish a fork of an open source React component to npm and use load it in my webpack after a successful npm install of my published module.

The webpack is throwing a Module not found: Error: Cannot resolve 'file' or 'directory' ./Slider.jsx in /home1... error when loading.

The lib/index.js file that my rc-tools build created is:

1'use strict';
2
3 module.exports = require('./Slider.jsx');

while, the main fork of the repo has

1'use strict';
2
3 module.exports = require('./Slider');

as their created lib/index.js.

I am using the same build (rc-tools) tool as them and have nearly identical package.json. Why is my repo creating a different index.js and is this the cause of my webpack.config not loading?

Here is the link to the npm component: https://www.npmjs.com/package/meraki-slider

2
  • The src/index.js file on GitHub is showing the require('./Slider') version. Have you (re)published the package with the require('./Slider.jsx') version? Commented Feb 26, 2016 at 21:44
  • @AdrianLynch , sorry, I had not updated the github. It is now up to date, here. To build locally, I am running npm run build which run rc-tools build script. Commented Feb 29, 2016 at 18:09

1 Answer 1

1

In my journey of learning about node and publishing, I simply forgot to remove the .jsx endings from my /src folder, which was causing my build to include them in my /lib folder and causing webpack to not compile. :P

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.