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
|
// @see https://babeljs.io/docs/en/next/config-files#project-wide-configuration
|
||||||
|
const path = require('path');
|
||||||
module.exports = api => {
|
module.exports = api => {
|
||||||
api.cache(() => process.env.NODE_ENV);
|
api.cache(() => process.env.NODE_ENV);
|
||||||
|
|
||||||
|
@ -52,7 +53,8 @@ module.exports = api => {
|
||||||
modules: (isCDNBundle || isESModule) ? false : 'auto',
|
modules: (isCDNBundle || isESModule) ? false : 'auto',
|
||||||
targets: {
|
targets: {
|
||||||
chrome: 58,
|
chrome: 58,
|
||||||
ie: 11
|
ie: 10,
|
||||||
|
browsers: [ 'ie >= 11' ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -115,7 +117,8 @@ module.exports = api => {
|
||||||
// isCDNBundle ? 'inline-webgl-constants' : {},
|
// isCDNBundle ? 'inline-webgl-constants' : {},
|
||||||
],
|
],
|
||||||
ignore: [
|
ignore: [
|
||||||
'node_modules',
|
// 'node_modules/d3-array',
|
||||||
|
// /node_modules\/(?![d3*])/,
|
||||||
...!isTest ? [
|
...!isTest ? [
|
||||||
'**/*.test.tsx',
|
'**/*.test.tsx',
|
||||||
'**/*.test.ts',
|
'**/*.test.ts',
|
||||||
|
|
|
@ -9,7 +9,14 @@ import babel from 'rollup-plugin-babel';
|
||||||
import glsl from './rollup-plugin-glsl';
|
import glsl from './rollup-plugin-glsl';
|
||||||
import postcss from 'rollup-plugin-postcss';
|
import postcss from 'rollup-plugin-postcss';
|
||||||
import url from 'postcss-url';
|
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) {
|
function resolveFile(filePath) {
|
||||||
return path.join(__dirname, '..', filePath);
|
return path.join(__dirname, '..', filePath);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +25,7 @@ module.exports = [
|
||||||
{
|
{
|
||||||
input: resolveFile('build/bundle.ts'),
|
input: resolveFile('build/bundle.ts'),
|
||||||
output: {
|
output: {
|
||||||
file: resolveFile('packages/l7/dist/l7.js'),
|
file: resolveFile(outputFile),
|
||||||
format: 'umd',
|
format: 'umd',
|
||||||
name: 'L7',
|
name: 'L7',
|
||||||
globals: {
|
globals: {
|
||||||
|
@ -28,7 +35,7 @@ module.exports = [
|
||||||
external: [
|
external: [
|
||||||
'mapbox-gl'
|
'mapbox-gl'
|
||||||
],
|
],
|
||||||
treeshake: true,
|
treeshake: minified,
|
||||||
plugins: [
|
plugins: [
|
||||||
alias(
|
alias(
|
||||||
{
|
{
|
||||||
|
@ -81,7 +88,8 @@ module.exports = [
|
||||||
babel({
|
babel({
|
||||||
extensions: [ '.js', '.ts' ]
|
extensions: [ '.js', '.ts' ]
|
||||||
}),
|
}),
|
||||||
terser(),
|
// terser(),
|
||||||
|
minified ? terser() : false,
|
||||||
analyze({
|
analyze({
|
||||||
summaryOnly: true,
|
summaryOnly: true,
|
||||||
limit: 20
|
limit: 20
|
||||||
|
|
|
@ -147,7 +147,8 @@
|
||||||
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
|
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
|
||||||
"tsc": "tsc",
|
"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",
|
"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",
|
"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",
|
"glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag",
|
||||||
"clean": "lerna run clean"
|
"clean": "lerna run clean"
|
||||||
|
|
Loading…
Reference in New Issue