I've been getting the following error when building:
error { [Error: ENOENT, open '/Users/marshallthompson/Sites/grm/public/apps/main/components/fleet-editor.js.js']
errno: 34,
code: 'ENOENT',
path: '/Users/marshallthompson/Sites/grm/public/apps/main/components/fleet-editor.js.js' } Error: ENOENT, open '/Users/marshallthompson/Sites/grm/public/apps/main/components/fleet-editor.js.js'
This only happens when instead of putting the module name I put the filename. I think it's supposed to work this way, so it doesn't technically qualify as a bug, but I can't think of any reason it HAS to be this way. It seems to me like we should be able to make steal recognize if a .js extension is already present, and therefore not append another one.
Since we're using the file extension plus a bang (.css!) to require/import other files, it would be more consistent to allow javascript to be imported with or without the extension. This would make even more sense if we get it to the point that the bang is optional for non-js files.
Here is one thing that's interesting about this problem that I think does qualify as a bug. This is my main.js file that throws the error:
require('./main.css!');
require('./components/fleet-editor.js');
If I change the css require to use import like this:
// No error thrown this way.
import './main.css!';
require('./components/fleet-editor.js');
It doesn't try to add the extra .js extension, so it doesn't throw the error upon building. If I do it the other way around, like this:
require('./main.css!');
import './components/fleet-editor.js';
The error still occurs on build. If both are imported, it still throws an error. But of course, if I do it this way and leave off the .js extension:
require('./main.css!');
require('./components/fleet-editor'); // No .js, let the party go on!
The build completes without a problem.
I think I'm smart enough to figure out how to leave the extension off of .js files, but for new-comers, if it's going to be required to stay this way, it ought to have a more useful message on how to fix it rather than just throw an error for them to decipher.