[Scripts > InjectPolyfill] Ensure node_modules exists
This commit is contained in:
parent
b3ffacf472
commit
11248d1455
1 changed files with 4 additions and 2 deletions
|
@ -1,12 +1,14 @@
|
|||
const { readdirSync, copyFileSync } = require('fs');
|
||||
const { readdirSync, copyFileSync, mkdirSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
const rootDir = join(__dirname, '..');
|
||||
const nodeModules = join(rootDir, 'src', 'node_modules');
|
||||
mkdirSync(nodeModules, { recursive: true }); // Ensure node_modules exists
|
||||
|
||||
const polyfillsDir = join(rootDir, 'polyfills');
|
||||
for (const file of readdirSync(polyfillsDir)) {
|
||||
const [ name ] = file.split('.');
|
||||
const jsPath = join(polyfillsDir, file);
|
||||
|
||||
copyFileSync(jsPath, join(rootDir, 'src', 'node_modules', name + '.js'));
|
||||
copyFileSync(jsPath, join(nodeModules, name + '.js'));
|
||||
}
|
Loading…
Reference in a new issue