systemjs: getting "unexpected token <" when loading a lib from a separate bundle
- Dominant language
- JavaScript
- Stars
- 402
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
**I'm submitting a bug report**
* **Library Version:**
0.30.1
**Please tell us about your environment:**
* **Operating System:**
Windows 10
* **Node Version:**
7.10.0
* **NPM Version:**
4.5.0
* **Browser:**
all
* **Language:**
TypeScript 2.3.4
**Current behavior:**
I'm trying to use a library from a separate bundle (so a third one in addition to `app-bundle` and `vendor-bundle`).
This approach works flawlessly when using the RequireJS loader.
The bundle contains `materialize-css` and `aurelia-materialize-bridge`.
`aurelia-materialize-bridge` exposes an Aurelia plugin which is used like this (in `main.js`):
```javascript
aurelia.use.plugin('aurelia-materialize-bridge', b => b.useAll());
```
There are no other direct references (maybe that plays a role, I don't know).
This is my bundle config:
```json
{
"name": "materialize-bundle.js",
"dependencies":[
"jquery",
{
"name": "materialize-css",
"path": "../node_modules/materialize-css/dist",
"main": "js/materialize.amd",
"deps": [
"jquery"
],
"resources": [
"css/materialize.css"
],
"exports": "Materialize"
},
{
"name": "aurelia-materialize-bridge",
"path": "../node_modules/aurelia-materialize-bridge/dist/amd",
"main": "index",
"deps": [
"jquery"
],
"resources": [
"**/*.{css,html}",
"index.js"
]
}
]
}
```
The app build just fine but when I load the app, I'm getting an error as soon as the plugin is loaded:
```
DEBUG [aurelia] Loading plugin aurelia-materialize-bridge.
vendor-bundle.js:1395 Unhandled rejection Error: Unexpected token <
Evaluating http://localhost:9001/aurelia-materialize-bridge
Loading http://localhost:9001/aurelia-materialize-bridge
```
The loader is trying to load this path `http://localhost:9001/aurelia-materialize-bridge` which does not exist. As a consequence, the actual response is the `index.html` file which the loader can't evaluate (of course). Thus the error `unexpected token <`. 😃
This can be solved by placing the configuration inside `vendor-bundle`.
**Expected/desired behavior:**
* **What is the expected behavior?**
I would expect Aurelia to load the above mentioned plugin from the `materialize-bundle` configured in `aurelia.json`.
* **What is the motivation / use case for changing the behavior?**
I want to use a third bundle for a rather big plugin.
Also maybe I'm lazy and I'd like to keep the same docs for `aurelia-materialize-bridge` when using the CLI with SystemJS instead of RequireJS. 😏
Just kidding, I often split large portions into separate bundles to have a little more control.
Contributor guide
Assessment
This issue has not been assessed yet.