aurelia/i18n

"Unable to find module with ID: aurelia-i18n" (Webpack)

mikeesouth opened this issue · 2 comments

I'm submitting a bug report

  • Library Version:
    1.6.1

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    7.3.0

  • NPM Version:
    4.5.0

  • JSPM OR Webpack AND Version
    webpack 3.0.0

  • Browser:
    all

  • Language:
    TypeScript 2.4.1

Current behavior:
As soon as I include .plugin('aurelia-i18n', ... I get this error at runtime, no errors during typescript compilation:

bluebird.js:5253 Error: Unable to find module with ID: aurelia-i18n
    at WebpackLoader.<anonymous> (aurelia-loader-webpack.js:187)
    at step (aurelia-loader-webpack.js:36)
    at Object.next (aurelia-loader-webpack.js:17)
    at aurelia-loader-webpack.js:11
    at Promise._execute (bluebird.js:968)

Instructions to reproduce:
I have not created any gist (at least not yet) but I reproduced it like this, based on the skeleton-navigation repo and the i18n guide from the documentation: http://aurelia.io/hub.html#/doc/article/aurelia/i18n/latest/i18n-with-aurelia

  1. clone the aurelia "skeleton-navigation" report**
  2. npm install aureila-i18n --save
  3. create locales\en\translation.json and locales\sv\translation.json
  4. add the following to src\main.ts:
    • import {I18N, Backend} from 'aurelia-i18n';
    • .plugin('aurelia-i18n', (instance) => {})
  • What is the expected behavior?
    That aureila-i18n is loaded and that the translations works as expected.

Am I missing something vital? I've tried to include the plugin initialization code within the brackets in .plugin('aurelia-i18n..., I tried to install and use i18next-xhr-backend and some other changes but nothing seems to help. Any ideas on what I'm missing?

Thanks for reporting the issue @mikeesouth, I think there is an issue with your configuration, as described here https://github.com/jods4/aurelia-webpack-build/wiki/Debugging-missing-modules#cant-find-module-id-at-runtime. Lets dig into this so we can update the docs to give a better instruction for the new webpack plugin

@zewa666 nice, thanks for that link. Google didn't help me find that one :) The problem was quickly solved by changing .plugin('aurelia-i18n', (instance) => { to .plugin(PLATFORM.moduleName('aurelia-i18n'), (instance) => {. That solved the issue, feel free to close this issue.

I would assume that the Documentation should be updated, at least for the Webpack part?