mirror of https://gitee.com/antv-l7/antv-l7
feat(l7) add roullup
This commit is contained in:
parent
73a57e3f60
commit
fd8670881a
|
@ -0,0 +1,49 @@
|
|||
import fs from 'fs';
|
||||
import sourcemaps from 'rollup-plugin-sourcemaps';
|
||||
import { plugins } from './build/rollup_plugins';
|
||||
const { BUILD, MINIFY } = process.env;
|
||||
const minified = MINIFY === 'true';
|
||||
const production = BUILD === 'production';
|
||||
const outputFile = !production
|
||||
? 'dist/l7-dev.js'
|
||||
: minified
|
||||
? 'dist/l7.js'
|
||||
: 'dist/l7-unminified.js';
|
||||
|
||||
const config = [
|
||||
{
|
||||
input: [ 'src/index.js', 'src/worker/worker.js' ],
|
||||
output: {
|
||||
dir: 'rollup/build/l7',
|
||||
format: 'amd',
|
||||
sourcemap: 'inline',
|
||||
indent: false,
|
||||
chunkFileNames: 'shared.js'
|
||||
},
|
||||
experimentalCodeSplitting: true,
|
||||
treeshake: production,
|
||||
plugins: plugins()
|
||||
},
|
||||
{
|
||||
input: 'rollup/mapboxgl.js',
|
||||
output: {
|
||||
name: 'mapboxgl',
|
||||
file: outputFile,
|
||||
format: 'umd',
|
||||
sourcemap: production ? true : 'inline',
|
||||
indent: false,
|
||||
intro: fs.readFileSync(
|
||||
require.resolve('./rollup/bundle_prelude.js'),
|
||||
'utf8'
|
||||
)
|
||||
},
|
||||
treeshake: false,
|
||||
plugins: [
|
||||
// Ingest the sourcemaps produced in the first step of the build.
|
||||
// This is the only reason we use Rollup for this second pass
|
||||
// sourcemaps()
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
export default config;
|
|
@ -2,7 +2,7 @@ import Engine from './engine';
|
|||
import { LAYER_MAP } from '../layer';
|
||||
import Base from './base';
|
||||
import LoadImage from './image';
|
||||
import WorkerPool from './worker';
|
||||
// import WorkerPool from './worker';
|
||||
// import { MapProvider } from '../map/AMap';
|
||||
import { getMap } from '../map/index';
|
||||
import Global from '../global';
|
||||
|
@ -22,7 +22,7 @@ export default class Scene extends Base {
|
|||
_initEngine(mapContainer) {
|
||||
this._engine = new Engine(mapContainer, this);
|
||||
this._engine.run();
|
||||
this.workerPool = new WorkerPool();
|
||||
// this.workerPool = new WorkerPool();
|
||||
compileBuiltinModules();
|
||||
}
|
||||
// 为pickup场景添加 object 对象
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Worker from '../worker/main.worker.js';
|
||||
class WorkerPool {
|
||||
constructor(workerCount) {
|
||||
this.workerCount = workerCount || Math.max(Math.floor(window.navigator.hardwareConcurrency / 2), 1);
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import Source from '../core//source';
|
||||
this.addEventListener('message', e => {
|
||||
const res = e.data;
|
||||
// res = {
|
Loading…
Reference in New Issue