i18n编译 适配mac
This commit is contained in:
parent
c48cd58de3
commit
5983a0f98b
|
|
@ -14,7 +14,10 @@ function parseFileModuleAndNs(cwd, filename) {
|
|||
const relativePath = relative(cwd, filename);
|
||||
|
||||
if (relativePath.startsWith('node_modules') || relativePath.startsWith('..')) { // 在测试环境下是相对路径
|
||||
const moduleRelativePath = relativePath.split('\\').slice(0, 2);
|
||||
const moduleRelativePath = relativePath
|
||||
.replace(/\\/g, '/')
|
||||
.split('/')
|
||||
.slice(0, 2);
|
||||
const modulePath = join(cwd, ...moduleRelativePath);
|
||||
const moduleDir = moduleRelativePath[1];
|
||||
|
||||
|
|
@ -23,9 +26,10 @@ function parseFileModuleAndNs(cwd, filename) {
|
|||
const { name } = require(join(modulePath, 'package.json'));
|
||||
ModuleDict[moduleDir] = name;
|
||||
moduleName = name;
|
||||
console.log(moduleDir, name);
|
||||
}
|
||||
const rel2paths = relative(modulePath, filename).split('\\');
|
||||
const rel2paths = relative(modulePath, filename)
|
||||
.replace(/\\/g, '/')
|
||||
.split('/');
|
||||
|
||||
let ns;
|
||||
switch (rel2paths[1]) {
|
||||
|
|
@ -51,10 +55,11 @@ function parseFileModuleAndNs(cwd, filename) {
|
|||
const { name } = require(join(cwd, 'package.json'));
|
||||
ModuleDict['./'] = name;
|
||||
moduleName = name;
|
||||
console.log('./', name);
|
||||
}
|
||||
|
||||
const rel2paths = relative(cwd, filename).split('\\');
|
||||
const rel2paths = relative(cwd, filename)
|
||||
.replace(/\\/g, '/')
|
||||
.split('/');
|
||||
|
||||
let ns;
|
||||
switch (rel2paths[1]) {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ const env = getClientEnvironment();
|
|||
|
||||
fs.emptyDirSync(paths.appBuild);
|
||||
|
||||
//copy
|
||||
const { copyLocaleFiles } = require('./locales/copy-mp-locales');
|
||||
copyLocaleFiles();
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.log(chalk.red(err.stack || err));
|
||||
|
|
|
|||
|
|
@ -214,8 +214,4 @@ function copyPublicFolder() {
|
|||
dereference: true,
|
||||
filter: (file) => file !== paths.appHtml,
|
||||
});
|
||||
|
||||
//copy
|
||||
const { copyLocaleFiles } = require('./locales/copy-web-locales');
|
||||
copyLocaleFiles();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ const env = getClientEnvironment();
|
|||
|
||||
fs.emptyDirSync(paths.appBuild);
|
||||
|
||||
//copy
|
||||
const { copyLocaleFiles } = require('./locales/copy-mp-locales');
|
||||
copyLocaleFiles();
|
||||
|
||||
webpack(config, (err, stats) => {
|
||||
if (err) {
|
||||
console.log(chalk.red(err.stack || err));
|
||||
|
|
|
|||
|
|
@ -112,9 +112,7 @@ checkBrowsers(paths.appPath, isInteractive)
|
|||
host: HOST,
|
||||
port,
|
||||
};
|
||||
//copy
|
||||
const { copyLocaleFiles } = require('./locales/copy-web-locales');
|
||||
copyLocaleFiles();
|
||||
|
||||
const devServer = new WebpackDevServer(serverConfig, compiler);
|
||||
// Launch WebpackDevServer.
|
||||
devServer.startCallback(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue