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