Skip to content
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

Intl.js 404 Not Found #61

Closed
tkallevik opened this issue Jan 26, 2016 · 11 comments
Closed

Intl.js 404 Not Found #61

tkallevik opened this issue Jan 26, 2016 · 11 comments

Comments

@tkallevik
Copy link

Hi

When running the a bundled version of my application I get the following error in Safari:

[Debug] DEBUG [aurelia] – "Loading plugin aurelia-i18n." (example.com, line 9)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) ([email protected], line 0)

Here is some parts of my config.js (I have exluded the parts I meant to be irrelevant in this case):

map: {
    ...
    "npm:[email protected]": {
      "Intl.js": "github:andyearnshaw/[email protected]",
      "aurelia-binding": "npm:[email protected]",
      "aurelia-dependency-injection": "npm:[email protected]",
      "aurelia-event-aggregator": "npm:[email protected]",
      "aurelia-loader-default": "npm:[email protected]",
      "aurelia-pal": "npm:[email protected]",
      "aurelia-templating": "npm:[email protected]",
      "aurelia-templating-resources": "npm:[email protected]",
      "i18next": "github:i18next/[email protected]"
    },
    ...
},
bundles: {
    "aurelia": [
      "github:components/[email protected]",
      "github:components/[email protected]/jquery",
      "github:i18next/[email protected]",
      "github:i18next/[email protected]/i18next",
      "github:jspm/[email protected]",
      "github:jspm/[email protected]/index",
      "github:twbs/[email protected]",
      "github:twbs/[email protected]/css/bootstrap.css!github:systemjs/[email protected]",
      "github:twbs/[email protected]/js/bootstrap",
      ...
      "npm:[email protected]",
      "npm:[email protected]/aurelia-i18n",
      "npm:[email protected]/base-i18n",
      "npm:[email protected]/defaultTranslations/relative.time",
      "npm:[email protected]/df",
      "npm:[email protected]/i18n",
      "npm:[email protected]/nf",
      "npm:[email protected]/relativeTime",
      "npm:[email protected]/rt",
      "npm:[email protected]/t",
      "npm:[email protected]/utils",
      ...
   ]
}

Can you help me solve this?

@EisenbergEffect
Copy link
Contributor

More than likely you need to actually add it to your bundle config so that it ends up in the distributable bundle.

@tkallevik
Copy link
Author

Ok, I just thought that it would be added since it is a dependency for the aurelia-i18n plugin, which is added to the bundle. i18next is another example of a dependency for that plugin, and that is added without me explicitly saying so.

@EisenbergEffect
Copy link
Contributor

@zewa666 Can you provide input on this? Is the Intl.js library statically imported or is it dynamically imported? I'm assuming it is loaded based on need. If that is the case, can you identify which browsers need it and which don't? Also can you update the docs to indicate that if supporting browsers that need it, then the bundle config will need to be appended?

@zewa666
Copy link
Member

zewa666 commented Jan 27, 2016

@EisenbergEffect yes the dependency on the i18n polyfill is a dynamic one. Browsers like Safari or IE < 11 and Node.JS do not provide a default implementation. Will create the README update.

@doktordirk
Copy link
Contributor

@zewa666 stupid question: other than in the tests i don't find a dependency on Intl.js anywhere. in that case moving it to devDependency would remove some problems

@zewa666
Copy link
Member

zewa666 commented Feb 3, 2016

Intl.js is loaded on demand if needed. Means if the browser or environment does not fully or at all support the Javascript Internationalization API, the plugin will load the polyfill.

So no, moving it to a devDependency thus is no option

zewa666 added a commit that referenced this issue Feb 3, 2016
document how the intl polyfill is used and that manual bundling
configuration is needed

fixes issue #61 (comment)
@zewa666 zewa666 closed this as completed Feb 3, 2016
@don-bluelinegrid
Copy link

Where is the documentation on how to bundle the polyfill?

This is working fine on Chrome, but on Safari I see:

"Intl API is not available. Trying to load the polyfill."

This occurs even when running in live dev mode (npm start, in the typescript-webpack skeleton).

How do we get the polyfill to be included?

Thanks,
Don

@don-bluelinegrid
Copy link

OK, I do see the README information about the polyfill, but it is referring to modifying the aurelia bootstrap() function.
https://github.com/aurelia/i18n#internationalization-api-polyfill

However, in the typescript-webpack skeleton, there is no bootstrap() function - it uses the configure() function in main.js. Can we also get documentation on how to adjust the aurelia configure() function for this?

Thanks,
Don

@ben-girardet
Copy link

I'm having the same issue. Any documentation on how to include the polyfill when using Aurelia with aurelia-cli ?

@zewa666
Copy link
Member

zewa666 commented Aug 19, 2016

@ben-girardet the best thing is to follow this guide on how to install the plugin with AureliaCLI. http://pragmatic-coder.net/installing-the-aurelia-i18n-plugin-in-a-cli-app/

on top of that in order to install the Polyfill, you'd additionally run
npm install intl
and add the following to the dependencies in aurelia.json

{
            "name": "intl",
            "path": "../node_modules/intl/dist",
            "main": "Intl.min"  <--- or Intl.complete
          },

@ben-girardet
Copy link

Thanks @zewa666 I was missing the part in the aurelia.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants