-
-
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
Getting "Unexpected token <" error since using SystemJS #659
Comments
@simonfox could you take a look? |
Yes no worries @JeroenVinke @RomainLanz I've created a new project with everything but Also what do your imports look like for that library? |
Actually looks like it could be because you have If that is the case, I'm not sure this is actually a bug. I can't find the module specifier specification, and I know virtually nothing about the details of ES6 spec, but I'm guessing that maybe RequireJS is a little more relaxed about the define id and SystemJS is following the spec. Can you try replacing the bundle package in
and then remove the |
OK I've got to the bottom of this. The two packages causing problems here have source map links in the dist script e.g. the last line of
Combine those two factors and the result is a bundle that contains
For better or worse RequireJS handles that case. @JeroenVinke would you like a PR to just add a newline before the wrapper is appended? Or is there some other consideration I have missed? |
Actually I think we will need to strip that sourcemap line completely. The source map will be broken from our bundling anyway. Let me know your thoughts @JeroenVinke |
Some external libraries ship with sourcemaps with the dist package including a `sourcemapUrl` link. This link causes problems during bundling, and is specifically exposed by anonymous amd modules and SystemJS loader (RequireJS). This change modifies amodro to strip any existing `sourcemapURL` link from the source of a referenced library that is being bundled. closes aurelia#659, related to aurelia#624
Some external libraries ship with sourcemaps with the dist package including a `sourcemapUrl` link. This link causes problems during bundling, and is specifically exposed by anonymous amd modules and SystemJS loader (RequireJS). This change modifies amodro to strip any existing `sourcemapURL` link from the source of a referenced library that is being bundled. closes aurelia#659, related to aurelia#624
I'm getting the same error if I use a library which I load from a separate bundle. So if I add another bundle to the The loader in this case is actually loading (from root) |
No, as there are no sourcemaps. 😃 Now I see this issue is about sourcemaps mostly. Maybe I should create a separate issue? |
@Thanood sounds good! |
Side note : It works fine with the Webpack bundler |
Hey 👋
Operating System : macOS Sierra
Node.js version : v8.1.2
npm version: 5.0.3
I have switched my loader from
RequireJS
toSystemJS
this morning.To make the change I have install a new aurelia application and I have compare
package.json
,tasks/*
,aurelia.json
andindex.html
files and made the change needed.The application bundle correctly, but when I try to launch it in the browser I have the error
Unexpected token <
at random place.Note that everything was working fine before making the change.
If we take a look to the
vendor-bundle.js
file at the line11707
we arrive on theloadModule
function.The package
@fivb/sdk
is a TypeScript package compiled and transpiled to ES5 in different module formats (amd
,commonjs
,es2015
,umd
).In my
aurelia.json
, I load it as anamd
package.Since SystemJS should handle
commonjs
as well, I have tried to use this version.Now the error
Unexpected token <
is gone for@fivb/sdk
but happen foraxios
.The line 3388 is the definition of
SystemJS
.Note that
axios
is used by@fivb/sdk
.Here's my current
aurelia.json
: https://gist.github.com/RomainLanz/cf6738932e73379dc62c994006e1fb18I can give access to this application repository and to
@fivb/sdk
if needed.The text was updated successfully, but these errors were encountered: