Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Replace require.context with individual requires. #160

Merged
merged 1 commit into from
Dec 6, 2015

Conversation

alexmingoia
Copy link
Contributor

Webpack's require.context is transpiled only if ipfs-api is loaded or bundled
using webpack. This broke modules that require ipfs-api and use browserify or
other bundlers (such as webui)

Fixes #159 by using individual requires. I opted for this because IMO maintaining a list of requires is less headache than dealing with the complexities of directory walking in different runtime contexts (browser, node, webpack, browserify, etc.)

Webpack's `require.context` is transpiled only if ipfs-api is loaded or bundled
using webpack. This broke modules that require ipfs-api and use browserify or
other bundlers.

Fixes ipfs-inactive#159
@daviddias
Copy link
Contributor

Thank you @alexmingoia ! This is great, definitly 👍 for making browserify work again :)

daviddias added a commit that referenced this pull request Dec 6, 2015
Replace `require.context` with individual requires.
@daviddias daviddias merged commit 9a6a28b into ipfs-inactive:master Dec 6, 2015
@dignifiedquire
Copy link
Contributor

@diasdavid :( not a big fan of this, but at least this code should be consistent between node and the browser then when we are using individual requires as there is no need for using require-dir in the first place now

@daviddias
Copy link
Contributor

It is a bit more verbose, but still looks good, you feel differently?

but at least this code should be consistent between node and the browser then when we are using individual requires as there is no need for using require-dir in the first place now

We are also close of getting the extra benefit of enabling devs to just require the api call they need like require('src/api/add'), if we make send an module that is required instead of passed on load :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants