UNPKG

799 BJavaScriptView Raw
1const fs = require('fs-extra')
2const path = require('path')
3const getFilePath = require('./get-client-file-path')
4
5module.exports = (filename, localeId) => {
6 // console.log(
7 // process.cwd(),
8 // ' | ',
9 // getFilePath(filename)
10 // )
11 // console.log(' ')
12 // console.log(process.env.SUPER_DIST_DIR)
13 // console.log(getFilePath(filename))
14 // console.log(path.resolve(
15 // process.env.SUPER_DIST_DIR,
16 // getFilePath(filename)
17 // ))
18 // console.log(' ')
19 return fs.readFileSync(
20 path.resolve(
21 // process.env.SUPER_DIST_DIR,
22 path.resolve(process.cwd(), process.env.SUPER_DIST_DIR),
23 'public/',
24 getFilePath(filename, localeId).replace(/^\//, '')
25 ),
26 'utf-8'
27 )
28}