Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Lib built with Browserify and NPM integration #1517

Closed
Florian-R opened this issue Oct 5, 2016 · 3 comments
Closed

Lib built with Browserify and NPM integration #1517

Florian-R opened this issue Oct 5, 2016 · 3 comments
Labels

Comments

@Florian-R
Copy link
Contributor

Description

Brunch try to resolve relative require calls inside an already bundled lib.

Expected behavior

Skip relative require in libs already browserified. TBH I don't know if it's possible, but I've seen some libs already bundled like this in the wild.

Actual behavior

Steps to reproduce :

  • Init a new brunch project with chaplin skeleton (with brunch and bower globally installed)
brunch new -s chaplin 
  • Bump Brunch to latest (FWIW, this is also present on master)
npm i --save --save-dev brunch@2.8.2
  • Check that all is fine
npm start
#everything is ok
  • Bump Chaplin to latest
npm i --save chaplin@1.2.0
  • Relaunch Brunch
npm start
  • Output
05 Oct 15:37:51 - info: application started on http://localhost:3333/
05 Oct 15:37:51 - error: DEPS_RESOLVE_FAILED of node_modules/chaplin/chaplin.js failed. Could not load module '../mediator' from '/home/florian/Bureau/repro/node_modules/chaplin'. Make sure the file actually exists. 
05 Oct 15:37:51 - info: compiled 28 files into 3 files, copied index.html in 1.2 sec

I've tried to debug this a bit, and it seems that deppack try to resolve this require in Chaplin, which obviously fail.
I'd happily send a PR, just need to know where to start in the first time.

Environment

  1. Brunch: 2.8.2
  2. Node: 6.7.0
  3. NPM: 3.10.8
  4. Operating system: Ubuntu 16.04.1 LTS
@noonien
Copy link

noonien commented Oct 25, 2016

Have you managed to solve this issue?

@Florian-R
Copy link
Contributor Author

Florian-R commented Oct 26, 2016

Nope, for now I do some hacky stuff to circumvent it (I pull Chaplin from Github and compile myself the source in a postinstall script).

Didn't had much time to dig the source neither.

Edit: Tried to upgrade to 2.9.1 just in case. The error persists.

@designermonkey
Copy link

We're seeing the following and I wonder if it's the same thing:

Uncaught Error: Cannot find module 'inherits' from 'stream-browserify/index.js'

This happens only on ubuntu (works fine on Mac OSX). I have tried tracking it down and it seems that for some reason the brunch require and function that create a relative require, just won't resolve the dependency, even though it is all in the packaged vendor.js file.

Is this the same thing?

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

No branches or pull requests

4 participants