Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: fix cjs bundle #1777

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import pkg from '../package.json';

const name = 'tdesign';
const esExternalDeps = Object.keys(pkg.dependencies || {});
const externalDeps = esExternalDeps.concat([/lodash/, /@babel\/runtime/]);
const externalDeps = esExternalDeps.concat([/@babel\/runtime/]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@babel/runtime 也可以去掉了

const externalPeerDeps = Object.keys(pkg.peerDependencies || {});
const banner = `/**
* ${name} v${pkg.version}
Expand Down Expand Up @@ -207,10 +207,13 @@ const libConfig = {
},
};

const cjsExternalException = ['lodash-es'];
const cjsExternal = externalDeps.concat(externalPeerDeps).filter((value) => !cjsExternalException.includes(value));

/** @type {import('rollup').RollupOptions} */
const cjsConfig = {
input: inputList,
external: externalDeps.concat(externalPeerDeps),
external: cjsExternal,
plugins: [multiInput()].concat(getPlugins()),
output: {
banner,
Expand Down