mirror of
https://github.com/openharmony/developtools_ace-js2bundle.git
synced 2026-07-19 10:15:08 -04:00
@@ -20,7 +20,11 @@ import JavascriptModulesPlugin from 'webpack/lib/javascript/JavascriptModulesPlu
|
||||
import CachedSource from 'webpack-sources/lib/CachedSource';
|
||||
import ConcatSource from 'webpack-sources/lib/ConcatSource';
|
||||
|
||||
import { circularFile } from './util';
|
||||
import {
|
||||
circularFile,
|
||||
useOSFiles,
|
||||
mkDir
|
||||
} from './util';
|
||||
|
||||
let mStats;
|
||||
let mErrorCount = 0;
|
||||
@@ -85,6 +89,10 @@ class ResultStates {
|
||||
});
|
||||
|
||||
compiler.hooks.done.tap('Result States', (stats) => {
|
||||
if (process.env.isPreview && process.env.aceSoPath &&
|
||||
useOSFiles && useOSFiles.size > 0) {
|
||||
writeUseOSFiles();
|
||||
}
|
||||
mStats = stats;
|
||||
warningCount = 0;
|
||||
noteCount = 0;
|
||||
@@ -241,4 +249,17 @@ function printError(buildPath) {
|
||||
}
|
||||
}
|
||||
|
||||
function writeUseOSFiles() {
|
||||
let oldInfo = '';
|
||||
if (!fs.existsSync(process.env.aceSoPath)) {
|
||||
const parent = path.join(process.env.aceSoPath, '..');
|
||||
if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) {
|
||||
mkDir(parent);
|
||||
}
|
||||
} else {
|
||||
oldInfo = fs.readFileSync(process.env.aceSoPath, 'utf-8') + '\n';
|
||||
}
|
||||
fs.writeFileSync(process.env.aceSoPath, oldInfo + Array.from(useOSFiles).join('\n'));
|
||||
}
|
||||
|
||||
module.exports = ResultStates;
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from './util';
|
||||
|
||||
module.exports = function(source, map) {
|
||||
source = parseRequireModule(source);
|
||||
source = parseRequireModule(source, this.resourcePath);
|
||||
this.cacheable && this.cacheable()
|
||||
const callback = this.async()
|
||||
callback(null, source, map)
|
||||
|
||||
Reference in New Issue
Block a user