mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-25 05:05:51 +10:00
19 lines
689 B
JavaScript
19 lines
689 B
JavaScript
const path = require('path')
|
|
const { fs } = require('@vuepress/shared-utils')
|
|
|
|
// This plugin generate a mirror es module of 'lib/prepare/I18n.js'
|
|
// Since for now Webpack doesn't allow 'ES6 import' to import a a commonjs
|
|
// module.
|
|
//
|
|
// Ref: https://github.com/webpack/webpack/issues/4039
|
|
module.exports = () => ({
|
|
name: '@vuepress/internal-i18n-temp',
|
|
|
|
// @internal/i18n
|
|
async clientDynamicModules () {
|
|
const i18nCommonjsModule = await fs.readFile(path.resolve(__dirname, '../prepare/I18n.js'), 'utf-8')
|
|
const i18nEsModule = i18nCommonjsModule.replace('module.exports =', 'export default')
|
|
return { name: 'i18n.js', content: i18nEsModule, dirname: 'internal' }
|
|
}
|
|
})
|