yeoman server
works fine, but yeoman build
looks for my main requirejs file in a strange place and fails:
<WARN> Unable to read "scripts/scripts/main.js" file (Error code: ENOENT). Use --force to continue. </WARN>
It seems to add that extra scripts/ directory because my baseUrl is ./scripts, but yeoman server
finds it fine in the correct place. Here is my setup, it's mostly default stuff:
in index.html:
<!-- build:js scripts/scripts.js -->
<script src="scripts/vendor/require.js" data-main="scripts/main"></script>
<!-- endbuild -->
in Gruntfile.js:
rjs: {
// no minification, is done by the min task
optimize: 'none',
baseUrl: './scripts',
wrap: true
},
relevant part of app tree:
.
├── Gruntfile.js
├── app
│ ├── index.html
│ └── scripts
│ ├── main.coffee
│ ├── vendor
│ │ ├── require.js
| | └── all other js library scripts
│ └── all my other scripts
└── package.json
If I remove the scripts/ directory from the data-main attribute like this data-main="main"
, it actually does build without error. Trying to open the built app in a browser results in a blank page and a console error though, and yeoman server
fails without finding main.js. No other tinkering with these parameters that I've tried has given me a successful yeoman build
.
I hope I'm just missing a small configuration quirk. Thanks for the help!
I think I was missing a simple name: 'main'
in the rjs configuration of my Gruntfile, so it should look like this:
rjs: {
// no minification, is done by the min task
optimize: 'none',
baseUrl: './scripts',
wrap: true,
name: 'main'
},
This correctly works with yeoman server
and yeoman build
.