mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
refactor: improve tree shaking abilities
Internal refactor completed in order to improve tree shaking and dead code removal. The public API, with an exception to ion-slides, has stayed the same. However, internally many changes were required so bundlers could better exclude modules which should not be bundled. Ultimately most changes resorted to removing references to `window` or `document`, or a module that referenced one of those. BREAKING CHANGES ion-slides was refactored to remove the external dependencies, and rewritten in TypeScript/ES6 modules to again improve tree shaking abilities.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { UMD_MODULE, ES_2015, NODE_MODULES_ROOT, PROJECT_ROOT, SRC_ROOT, SRC_COMPONENTS_ROOT } from './constants';
|
||||
import { NODE_MODULES_ROOT, PROJECT_ROOT, SRC_ROOT } from './constants';
|
||||
import { src, dest } from 'gulp';
|
||||
import { join } from 'path';
|
||||
import * as fs from 'fs';
|
||||
@ -138,17 +138,6 @@ export function copyFile(srcPath: string, destPath: string) {
|
||||
fs.writeFileSync(destPath, sourceData);
|
||||
}
|
||||
|
||||
export function copySwiperToPath(distPath: string, moduleType: string) {
|
||||
copyFile(`${SRC_COMPONENTS_ROOT}/slides/swiper-widget.d.ts`, `${distPath}/swiper-widget.d.ts`);
|
||||
if (!moduleType || moduleType === UMD_MODULE) {
|
||||
copyFile(`${SRC_COMPONENTS_ROOT}/slides/swiper-widget.js`, `${distPath}/swiper-widget.js`);
|
||||
} else if (moduleType === ES_2015) {
|
||||
copyFile(`${SRC_COMPONENTS_ROOT}/slides/swiper-widget.es2015.js`, `${distPath}/swiper-widget.js`);
|
||||
} else {
|
||||
copyFile(`${SRC_COMPONENTS_ROOT}/slides/swiper-widget.system.js`, `${distPath}/swiper-widget.system.js`);
|
||||
}
|
||||
}
|
||||
|
||||
export function runNgc(pathToConfigFile: string, done: Function) {
|
||||
let exec = require('child_process').exec;
|
||||
var shellCommand = `node --max_old_space_size=8096 ${PROJECT_ROOT}/node_modules/.bin/ngc -p ${pathToConfigFile}`;
|
||||
|
||||
Reference in New Issue
Block a user