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

The default backend loader doesn't work with cli+bundler+systemjs #289

Closed
huochunpeng opened this Issue Nov 14, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@huochunpeng
Member

huochunpeng commented Nov 14, 2018

@zewa666 I need to modify this line

const response = await Backend.loader.loadText(url);

to

const response = await Backend.loader.loadText(SystemJS.normalizeSync(url));

In order to make it work on cli+bundler+systemjs, it is something related to how systemjs normalize module id with plugin subfix.

The aurelia-loader has an abstraction on normalize but I have no reference to 2nd parameter relativeTo. (the 2nd parameter on SystemJS.normalizeSync is optional, but it's required on aurelia loader abstraction)

const response = await Backend.loader.loadText(
  Backend.loader.normalizeSync(url, relativeTo_is_not_accessable_here)
);

requirejs has no such issue.

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Nov 14, 2018

Looks like this is not aurelia-i18n bug. An easier fix is to remove following code from aurelia-loader-default.

https://github.com/aurelia/loader-default/blob/6bb824869f2969614694a7f568c4dd4c56004001/src/index.js#L211-L224

That code block is unnecessary, as cli+bundler provides systemjs text plugin from npm package systemjs-plugin-text.

It looks like the double definition of text plugin confused systemjs runtime.
@EisenbergEffect for that inline text plugin for systemjs, is it designed to support jspm setup?

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Nov 14, 2018

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Nov 14, 2018

@huochunpeng Can you submit a PR to address it? If so, I can make a release this week.

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Nov 14, 2018

@EisenbergEffect is it safe to remove it? I don't know the history.

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Nov 14, 2018

I have no idea. That's been there for years.

huochunpeng added a commit to huochunpeng/loader-default that referenced this issue Nov 14, 2018

fix: remove unnecessary inline SystemJS text plugin
Both cli+bundler+systemjs and skeleton-navigation (jspm skeletons) bundle npm package systemjs-plugin-text. The previous inline text plugin in loader-default is unnecessary, and it prevents aurelia-i18n-loader from working properly with SystemJS.

closes aurelia/i18n#289
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment