i18next-scanner
i18next-scanner copied to clipboard
i18next-scanner for gulp is not work with next-i18next
gulpfile.js:
var gulp = require('gulp');
var scanner = require('i18next-scanner');
gulp.task('i18next', function() {
return gulp.src(['pages/**/*.{js,html}'])
.pipe(scanner({
lngs: ['en', 'id', 'zh_TW', 'zh_CN', 'th', 'ms', 'my'], // supported languages
resource: {
// the source path is relative to current working directory
loadPath: 'static/locales/{{lng}}/{{ns}}.json',
// the destination path is relative to your `gulp.dest()` path
savePath: 'locales/{{lng}}/{{ns}}.json'
}
}))
.pipe(gulp.dest('static'));
});
gulp.task('t', ['i18next']);
[16:17:08] Using gulpfile /Applications/hust-dev/joox-web-nextjs/gulpfile.js [16:17:08] Starting 'i18next'... i18next-scanner: Unable to parse Trans component from "/Applications/hust-dev/joox-web-nextjs/pages/_app.js" Error: acorn-private-class-elements does not support mixing different acorn copies i18next-scanner: Unable to parse Trans component from "/Applications/hust-dev/joox-web-nextjs/pages/_error.js" Error: acorn-private-class-elements does not support mixing different acorn copies i18next-scanner: Unable to parse Trans component from "/Applications/hust-dev/joox-web-nextjs/pages/index.js" Error: acorn-private-class-elements does not support mixing different acorn copies i18next-scanner: Unable to parse Trans component from "/Applications/hust-dev/joox-web-nextjs/pages/second-page.js" Error: acorn-private-class-elements does not support mixing different acorn copies [16:17:08] Finished 'i18next' after 54 ms [16:17:08] Starting 't'... [16:17:08] Finished 't' after 44 μs
Had similar issues yesterday. Deleted my 'lock' file and node_modules directory, did a fresh install, with the latest version of acorn as a new dependency. Still didn't work. Finally got around it by adding a "resolutions" entry in my package.json, pointing to the scanner's internal version.
"resolutions": {
"i18next-scanner/**/acorn": "6.1.1"
}
Team is went to a holiday? Issue still open! Had the same issue
Team is went to a holiday? Issue still open! Had the same issue
It is open source, therefore you are the team.
@huanglijiao @pinokara
It stated that you might have two acorn copies in your project. https://github.com/acornjs/acorn-private-class-elements/blob/master/index.js#L22-L24
if (cur !== acorn.Parser) {
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
}
Try npm ls
to see all the occurrences in the dependency tree.
Remove both node_modules
and package-lock.json
and do a fresh install should work.