mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
06731d8e70
* fix(project): fix/1778-import-on-demand-not-working - Fix the issue that when building utils the functions are inlined * - remove unnecessary variable
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
/* eslint-disable */
|
|
const pkg = require('../package.json')
|
|
const path = require('path')
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
|
const rollup = require('rollup')
|
|
const typescript = require('rollup-plugin-typescript2')
|
|
|
|
const deps = Object.keys(pkg.dependencies)
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const file = process.argv[2];
|
|
const defaultOpts = {
|
|
input: path.resolve(root, file),
|
|
plugins: [
|
|
nodeResolve(),
|
|
typescript({
|
|
tsconfigOverride: {
|
|
compilerOptions: {
|
|
declaration: false,
|
|
},
|
|
'exclude': [
|
|
'node_modules',
|
|
'__tests__',
|
|
],
|
|
},
|
|
abortOnError: false,
|
|
}),
|
|
],
|
|
external() {
|
|
return true
|
|
},
|
|
}
|
|
|
|
const run = async (name) => {
|
|
const esm = {
|
|
format: 'es',
|
|
file: `es/${name}`,
|
|
};
|
|
const cjs = {
|
|
format: 'cjs',
|
|
file: `lib/${name}`,
|
|
exports: 'named',
|
|
}
|
|
|
|
const bundle = await rollup.rollup(defaultOpts);
|
|
await Promise.all([bundle.write(esm), bundle.write(cjs)]);
|
|
console.log(name, 'build finished');
|
|
}
|
|
|
|
let normalizedName = file.slice(11); // remove ./packages
|
|
|
|
run(`${normalizedName.split('.').shift()}.js`);
|