-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemjs: getting "unexpected token <" when loading a lib from a separate bundle #676
Comments
Additional note: |
Reproduction repo: https://github.com/Thanood/md-todo-systemjs The sass files are not loaded, I've chosen the wrong CSS processor. Please ignore that. 😃 |
@simonfox do you have time to look into this one? |
@JeroenVinke sure, might be a couple of days away though @Thanood thank you for the detailed issue with repro 👍 |
I've had a quick look at this, the SystemJS config for the materialize bundle is missing an entry for
Just need to ensure SystemJS config has the package name included in the bundle definition (a long with the traced sources). I will put a PR together later today or tomorrow. |
It works in the vendor bundle because that is loaded via a script tag so the wrapper module is evaluated before the attempt to load the plugin. |
`Bundle.getBundledModuleIds` was only returning the ids of the traced files in the case of a package dependency. This change modifies `DependencyInclusion` to include the actual package name in the module ids for the dependency. closes aurelia#676
Thanks for looking at this. 😃 👍 |
fix(systemjs-bundling): include dependency name in bundle config
I tried out this fix and it does solve the error mentioned in this issue, but I got another one: #679 (comment). |
Shouldn't this define('aurelia-materialize-bridge', ['aurelia-materialize-bridge/index'], function (main) { return main; }); rather be something like define('aurelia-materialize-bridge', ['aurelia-materialize-bridge/index', 'jquery'], function (main) { return main; }); instead when deps are configured like that: {
"name": "aurelia-materialize-bridge",
"path": "../node_modules/aurelia-materialize-bridge/dist/amd",
"main": "index",
"deps": [
"jquery"
],
"resources": [
"**/*.{css,html}",
"index.js"
]
} AFAIK the error message @JeroenVinke gets in #679 (comment) ( |
@JeroenVinke @Thanood this is a hairy one! The problem is in I'm not sure the requirejs opitmizer build is appropriate in this instance. Using a package definition similar to this for materialize-css gets you past that error, but you then get a 404 from an attempt to load scripts/picker.js I tried working backwards from from a jspm/SystemJS project with materialize-css working as expected. But even then, the jspm install adds a I also looked at a Any ideas? |
Maybe @guybedford could give us some hints? |
Hmm, It's used like this if the files are in project root: The result is this module definition: https://gist.github.com/Thanood/e37e239a7d90a1dc3c2789d6f650116e It's still exposing globals. Materialize depends on it, unfortunately. Maybe even |
@Thanood yeah that is the build that is causing the Adding
to I did try prepend also, but didn't manage to get that to work. |
I'm submitting a bug report
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
andvendor-bundle
).This approach works flawlessly when using the RequireJS loader.
The bundle contains
materialize-css
andaurelia-materialize-bridge
.aurelia-materialize-bridge
exposes an Aurelia plugin which is used like this (inmain.js
):There are no other direct references (maybe that plays a role, I don't know).
This is my bundle config:
The app build just fine but when I load the app, I'm getting an error as soon as the plugin is loaded:
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 theindex.html
file which the loader can't evaluate (of course). Thus the errorunexpected token <
. 😃This can be solved by placing the configuration inside
vendor-bundle
.Expected/desired behavior:
I would expect Aurelia to load the above mentioned plugin from the
materialize-bundle
configured inaurelia.json
.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.
The text was updated successfully, but these errors were encountered: