Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini committed Sep 27, 2023
1 parent af81b2b commit c355f9c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
5 changes: 3 additions & 2 deletions bundle/g2.full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
geolib,
stdlib,
threedlib,
autolib,
} from '../src/lib';
import { extend, Runtime } from '../src/api';
import { API, CompositionAPI } from '../src/api/extend';
Expand All @@ -15,10 +16,10 @@ export * from '../src/exports';
/**
* G2 full library initial all the libs, include 3D and auto.
*/
const library = { ...stdlib(), ...threedlib() };
const library = { ...stdlib(), ...autolib(), ...threedlib() };

export const Chart = extend(Runtime, library);
export interface Chart extends API<G2Spec, typeof library> {}
export interface CompositionNode extends CompositionAPI<typeof library> {}

export { corelib, plotlib, graphlib, geolib, stdlib, threedlib };
export { corelib, plotlib, graphlib, geolib, stdlib, threedlib, autolib };
9 changes: 1 addition & 8 deletions bundle/g2.std.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
corelib,
plotlib,
graphlib,
geolib,
stdlib,
threedlib,
} from '../src/lib';
import { corelib, plotlib, graphlib, geolib, stdlib } from '../src/lib';
import { extend, Runtime } from '../src/api';
import { API, CompositionAPI } from '../src/api/extend';
import { G2Spec } from '../src/spec';
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@antv/g-webgl": "^1.9.8",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^17.4.4",
"@optimize-lodash/rollup-plugin": "^4.0.3",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-terser": "^0.4.3",
Expand Down Expand Up @@ -122,6 +123,7 @@
"jsdom": "^19.0.0",
"limit-size": "^0.1.4",
"lint-staged": "^10.5.4",
"lodash-es": "^4.17.21",
"npm-run-all": "^4.1.5",
"pixelmatch": "5.3.0",
"pngjs": "^6.0.0",
Expand Down Expand Up @@ -163,7 +165,7 @@
},
{
"path": "dist/g2.full.min.js",
"limit": "350 Kb",
"limit": "400 Kb",
"gzip": true
}
],
Expand Down
9 changes: 7 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import terser from '@rollup/plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import json from '@rollup/plugin-json';
import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';

const isBundleVis = !!process.env.BUNDLE_VIS;

Expand All @@ -21,7 +23,8 @@ export default [
treeshake: {
preset: 'smallest',
// Set `src/exports` as a sideEffects file.
moduleSideEffects: (id, external) => id.includes('src/exports.ts') ? true : false,
moduleSideEffects: (id, external) =>
id.includes('src/exports.ts') ? true : false,
},
output: [
{
Expand All @@ -39,8 +42,10 @@ export default [
typescript({
useTsconfigDeclarationDir: true,
}),
optimizeLodashImports(),
json(),
terser(),
],
context: 'window', // Disable 'THIS_IS_UNDEFINED' warnings
}))
})),
];
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { corelib, plotlib, graphlib, geolib, stdlib, threedlib } from './lib';
import {
corelib,
plotlib,
graphlib,
geolib,
stdlib,
threedlib,
autolib,
} from './lib';
import { extend, Runtime } from './api';
import { API, CompositionAPI } from './api/extend';
import { G2Spec } from './spec';

export { corelib, plotlib, graphlib, geolib, stdlib, threedlib };
export { corelib, plotlib, graphlib, geolib, stdlib, threedlib, autolib };

export * from './exports';

Expand Down

0 comments on commit c355f9c

Please sign in to comment.