linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Adding node dependency to package.json #273

Closed olimart closed 10 years ago

olimart commented 10 years ago

Hi, trying to add the octonode library here is what I did.

  1. lineman new my-app
  2. cd my-app
  3. Added "octonode": "0.6.x" under devDependencies of package.json
  4. npm install
  5. lineman run
  6. Added var github = require('octonode'); in hello.js
  7. Open localhost:8000, inspect browser console. Error raise ReferenceError: Can't find variable: require

What am I missing to add node packages?

searls commented 10 years ago

Lineman doesn't support loading node packages from your client-side code out of the box. 

For that you'd need to use browserify (which is still only experimentally supported). You can kick it off with npm i --save-dev lineman-browserify

On Mon, May 26, 2014 at 12:37 AM, Olivier notifications@github.com wrote:

Hi, trying to add the octonode library here is what I did.

  1. lineman new my-app
  2. cd my-app
  3. Added "octonode": "0.6.x" under devDependencies of package.json
  4. npm install
  5. lineman run
  6. Added var github = require('octonode'); in hello.js
  7. Open localhost:8000, inspect browser console. Error raise ReferenceError: Can't find variable: require

What am I missing to add node packages?

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/273

olimart commented 10 years ago

ok. thanks.

jasonkarns commented 10 years ago

@olimart You might look into Browserify (and lineman-browserify) for shimming node modules into the client-side build.