javascriptnpmbrunch

app build on brunch uses hardcoded paths for app.css/app.js/... files


I have installed brunch on windows via npm (npm install brunch)

Then I created and built new project in my www root directory (apache www root):

cd .../www
brunch new someproject
cd someproject
brunch build

When I type localhost/someproject/public in browser there are following errors in console log (chrome):

GET http://localhost/stylesheets/app.css 404 (Not Found) localhost:9
GET http://localhost/javascripts/vendor.js 404 (Not Found) localhost:10
GET http://localhost/javascripts/app.js 404 (Not Found) localhost:10
Uncaught ReferenceError: require is not defined 

So it seems that paths for those files are hardcored from root path... How I can make this work - some change in brunch config file?

I know I can use brunch watch --server and type localhost:3333 but I want to use apache instead. So basically it is a problem of deploying app into production (public folder).


Solution

  • For this particular case you need to change app/assets/index.html paths to js / CSS.