require from of css fails without proper logging making it hard to diagnose
See original GitHub issueI’m submitting a bug report
- Library Version: 0.18.0
Please tell us about your environment:
- Operating System: Windows 10
- Node Version: 4.3.7
- NPM Version: 3.10.7
- Browser: Chrome
- Language: TypeScript
Current behavior:
Expected/desired behavior:
In your html do a require that has an invalid name/path
<require from="./aurelia-grid.css"></require>
The load fails with a crash
vendor-bundle.js:formatted:4098 Uncaught TypeError: h.load is not a function
Which makes it impossible to figure out what the error is.
The problem is in this line: https://github.com/aurelia/cli/blob/b02946c6b45262781f85ebc3ff1ae18e8102669f/lib/build/amodro-trace/lib/loader/require.js#L1092 map.name in that line has the exact path you are trying to load e.g. “./aurelia-grid.css”.
A quick check for if (!plugin.load) { .. }
throw error that it could not find file map.name “./aurelia-grid.css” and maybe the context would save lots of hours of debugging.
- What is the expected behavior? Throw a proper error that can point to the problem.
- What is the motivation / use case for changing the behavior? Simplify diagnosing.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
@nexbit no, it’s not a resource path problem. All data have write correct in
vendor-bundle.js
bytext!name_of_css
index. Sometimes, you can fix it by change module position inaurelia.json
config file – like add new library with css before or after bootstrap v4 library.Here is firefox log:
After that I found that line of code in
\scripts\require.js
and addconsole.log(plugin);
before load. And thatplugin
param was empty object. Other resources (not CSS) loads good.@EisenbergEffect considering that the tracer was completely re-written - I think this one is safe to close.