Closed nicooga closed 8 years ago
@goshakkk
The files are being concatenated into vendor.js, and I can even see them in the web inspector. They dont seem to be modulairzed, unlike other packages from npm. Opened an issue in the wrong repo though.
I think I found out the root of the problem. When I require vedor.js its throws an error:
"Cannot find module 'process' from '/'"
when trying to process = require('process')
. This makes sense because the server warned that browser.js was compiled but not writen:
01 May 03:37:52 - info: application started on http://localhost:3333/
01 May 03:37:54 - warn: /usr/lib/node_modules/brunch/node_modules/deppack/node_modules/node-browser-modules/node_modules/process/browser.js compiled, but not written. Check your javascripts.joinTo config
01 May 03:37:55 - info: compiling
01 May 03:37:55 - info: compiled 17 files into 3 files, copied 2 in 4.3 sec
01 May 03:37:56 - info: copied index.html in 70ms¡
Solved. Modified my joinTo config to include that file:
module.exports =
files:
javascripts:
joinTo:
'vendor.js': /^(bower_components|(\/usr\/lib\/)?node_modules)/
'app.js': /^app\//
@nicooga in general, it's better to have a local brunch in your project instead of using a global one. That way, the vendor regexp won't have to account for the global location of brunch
The compilation fails with a message
error: Resolving deps of app/initialize.js failed. Could not load module 'angular-jsonapi' from '/home/cygnus/Projects/home_accounting_front/app'. Possible solution: add 'angular-jsonapi' to package.json and
npm install
.I went through the steps described in the FAQ to use bower packages: Run a
bower init
to get my bower.json, added the deps, installed, etc.The package I'm trying to use angular-jsonapi has a valid bower.json file with a
main
property.I saw in this SO question that brunch gives a very descriptive error message when a bower package does not have a
main
property, so this probably is not the problem.