mirror of https://gitee.com/antv-l7/antv-l7
fix: babel config
This commit is contained in:
parent
b9f8485161
commit
3df70e6647
|
@ -1,4 +1,5 @@
|
|||
// @see https://babeljs.io/docs/en/next/config-files#project-wide-configuration
|
||||
const path = require('path');
|
||||
module.exports = api => {
|
||||
api.cache(() => process.env.NODE_ENV);
|
||||
|
||||
|
@ -52,7 +53,8 @@ module.exports = api => {
|
|||
modules: (isCDNBundle || isESModule) ? false : 'auto',
|
||||
targets: {
|
||||
chrome: 58,
|
||||
ie: 11
|
||||
ie: 10,
|
||||
browsers: [ 'ie >= 11' ]
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -115,7 +117,8 @@ module.exports = api => {
|
|||
// isCDNBundle ? 'inline-webgl-constants' : {},
|
||||
],
|
||||
ignore: [
|
||||
'node_modules',
|
||||
// 'node_modules/d3-array',
|
||||
// /node_modules\/(?![d3*])/,
|
||||
...!isTest ? [
|
||||
'**/*.test.tsx',
|
||||
'**/*.test.ts',
|
||||
|
|
|
@ -9,7 +9,14 @@ import babel from 'rollup-plugin-babel';
|
|||
import glsl from './rollup-plugin-glsl';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import url from 'postcss-url';
|
||||
|
||||
const { BUILD, MINIFY } = process.env;
|
||||
const minified = MINIFY === 'true';
|
||||
const production = BUILD === 'production';
|
||||
const outputFile = !production
|
||||
? 'packages/l7/dist/l7-dev.js'
|
||||
: minified
|
||||
? 'packages/l7/dist/l7.js'
|
||||
: 'packages/l7/dist/l7-dev.js';
|
||||
function resolveFile(filePath) {
|
||||
return path.join(__dirname, '..', filePath);
|
||||
}
|
||||
|
@ -18,7 +25,7 @@ module.exports = [
|
|||
{
|
||||
input: resolveFile('build/bundle.ts'),
|
||||
output: {
|
||||
file: resolveFile('packages/l7/dist/l7.js'),
|
||||
file: resolveFile(outputFile),
|
||||
format: 'umd',
|
||||
name: 'L7',
|
||||
globals: {
|
||||
|
@ -28,7 +35,7 @@ module.exports = [
|
|||
external: [
|
||||
'mapbox-gl'
|
||||
],
|
||||
treeshake: true,
|
||||
treeshake: minified,
|
||||
plugins: [
|
||||
alias(
|
||||
{
|
||||
|
@ -81,7 +88,8 @@ module.exports = [
|
|||
babel({
|
||||
extensions: [ '.js', '.ts' ]
|
||||
}),
|
||||
terser(),
|
||||
// terser(),
|
||||
minified ? terser() : false,
|
||||
analyze({
|
||||
summaryOnly: true,
|
||||
limit: 20
|
||||
|
|
|
@ -147,7 +147,8 @@
|
|||
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
|
||||
"tsc": "tsc",
|
||||
"watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
|
||||
"bundle": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js",
|
||||
"bundle": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment BUILD:production,MINIFY:true ",
|
||||
"bundle-dev": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment 'BUILD:production,MINIFY:false'",
|
||||
"bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch",
|
||||
"glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag",
|
||||
"clean": "lerna run clean"
|
||||
|
|
Loading…
Reference in New Issue