Skip to content

Commit

Permalink
fix(ts): workaround for allowSyntheticDefaultImports
Browse files Browse the repository at this point in the history
this makes it not mandatory anymore to setup allowSyntheticDefaultImports in your tsconfig, when using the i18n plugin

resolves #236
  • Loading branch information
josundt authored and zewa666 committed Oct 21, 2017
1 parent 5deb4d2 commit ec6dbbe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions build/tasks/build.js
Expand Up @@ -16,6 +16,7 @@ var gulpIgnore = require('gulp-ignore');
var merge = require('merge2');
var jsName = paths.packageName + '.js';
var compileToModules = ['es2015', 'commonjs', 'amd', 'system', 'native-modules'];
var replace = require("gulp-replace");

function cleanGeneratedCode() {
return through2.obj(function(file, enc, callback) {
Expand Down Expand Up @@ -64,6 +65,7 @@ gulp.task('build-index', function() {

gulp.task('build-es2015-temp', function () {
return gulp.src(paths.output + jsName)
.pipe(replace('import i18next from', 'import * as i18next from')) // Replace babel cjs import syntax with TS cjs import syntax
.pipe(to5(assign({}, compilerOptions.commonjs())))
.pipe(gulp.dest(paths.output + 'temp'));
});
Expand Down
4 changes: 1 addition & 3 deletions dist/aurelia-i18n.d.ts
@@ -1,5 +1,5 @@
import * as LogManager from 'aurelia-logging';
import i18next from 'i18next';
import * as i18next from 'i18next';
import {
resolver
} from 'aurelia-dependency-injection';
Expand Down Expand Up @@ -85,8 +85,6 @@ export declare class Backend {
readMulti(languages?: any, namespaces?: any, callback?: any): any;
read(language?: any, namespace?: any, callback?: any): any;
loadUrl(url?: any, callback?: any): any;

/* no retry */
create(languages?: any, namespace?: any, key?: any, fallbackValue?: any): any;
}
export declare class BaseI18N {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -102,6 +102,7 @@
"gulp-ignore": "^2.0.1",
"gulp-insert": "^0.5.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-typedoc": "^2.0.0",
"gulp-typedoc-extractor": "0.0.8",
"gulp-typescript": "^2.13.6",
Expand Down
4 changes: 2 additions & 2 deletions src/customTypings/i18next.d.ts
Expand Up @@ -121,5 +121,5 @@ declare namespace I18next {
declare module 'i18next' {
var i18next:I18next.I18n;

export default i18next;
}
export = i18next;
}

1 comment on commit ec6dbbe

@gerbendekker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, solves the issue I just bumped into

Please sign in to comment.