componentjs / builder2.js

builder for component
50 stars 20 forks source link

Lots of "could not resolve" errors on existing components #36

Closed dominicbarnes closed 10 years ago

dominicbarnes commented 10 years ago

In my app, I'm seeing a lot of these kinds of errors:

  component-builder:scripts could not resolve "type-component" from "component~each@0.1.0" +0ms
  component-builder:scripts could not resolve "./lib/debug" from "visionmedia/debug"'s file "index.js" +490ms
  component-builder:scripts could not resolve "each-component" from "segmentio~isodate-traverse@0.3.2" +143ms
  component-builder:scripts could not resolve "./lib-cov" from "treetopllc/noble.js"'s file "index.js" +17ms
  component-builder:scripts could not resolve "bind-component" from "segmentio~bind-all@0.0.2" +108ms
  component-builder:scripts could not resolve "type-component" from "segmentio~bind-all@0.0.2" +0ms
  component-builder:scripts could not resolve "bind-component" from "ianstormtaylor~bind@0.0.2" +0ms
  component-builder:scripts could not resolve "each-component" from "segmentio~validator@0.0.9" +183ms
  component-builder:scripts could not resolve "stop" from "yields~stop@0.0.2" +5ms
  component-builder:scripts could not resolve "stop" from "yields~stop@0.0.2" +0ms
  component-builder:scripts could not resolve "events" from "visionmedia~batch@0.5.0" +59ms
  component-builder:scripts could not resolve "popup" from "component~popup@v0.0.2" +153ms
  component-builder:scripts could not resolve "jquery" from "./scripts/vendor/jquery" +249ms

       error : Error: could not resolve "./leaflet" from "mapbox"'s file "index.js"

I didn't realize component was going to start analyzing files for require calls, and it seems like this can break if people do "unexpected" things with require. (like try/catch to support both node and component for example)

What exactly is "resolution" phase doing? (I'd like to understand better so I can work with it)

jonathanong commented 10 years ago

kind of the same with browserify. it'll work as long as people don't do crazy stuff with require() like require(variable + '-component').

it'll look through all the require calls and replace them if it finds a suitable file/component as specified in the component.json. if it doesn't get replaced, it'll just show this debug message and not change anything. these debug messages aren't an issue unless your build actually stops working.

the purpose is to register modules with canonical names like segmentio-validator@0.0.9 instead of all those aliases the builder did before.

jonathanong commented 10 years ago

not sure why we're getting component-builder:scripts could not resolve "stop" from "yields~stop@0.0.2" though. i don't see a require('stop') anywhere o.O https://github.com/yields/stop/blob/master/index.js

dominicbarnes commented 10 years ago

debug automatically assigned component-builder:scripts to be red, so I mentally was treating it like an error lol. Never mind then, I'll keep in mind that I need to be non-tricky with require...but I can't always promise that, so as I get further along in getting things to build I'll keep my eyes peeled.

jonathanong commented 10 years ago

it should be less necessary now https://github.com/component/guide/blob/master/creating-components/best-practices.md#publishing-to-npm :D