mirror of https://gitee.com/antv-l7/antv-l7
fix(babel): gatsby env
This commit is contained in:
parent
b91c81afd9
commit
48be6c3eee
|
@ -1,14 +1,11 @@
|
||||||
// @see https://babeljs.io/docs/en/next/config-files#project-wide-configuration
|
// @see https://babeljs.io/docs/en/next/config-files#project-wide-configuration
|
||||||
module.exports = api => {
|
module.exports = api => {
|
||||||
api.cache(() => process.env.NODE_ENV);
|
api.cache(() => process.env.NODE_ENV);
|
||||||
|
|
||||||
const isSite = api.env('site');
|
|
||||||
const isCDNBundle = api.env('bundle');
|
const isCDNBundle = api.env('bundle');
|
||||||
const isCommonJS = api.env('cjs');
|
const isCommonJS = api.env('cjs');
|
||||||
const isESModule = api.env('esm');
|
const isESModule = api.env('esm');
|
||||||
const isTest = api.env('test');
|
const isTest = api.env('test');
|
||||||
|
if (process.env.GATSBY === 'true') { //
|
||||||
if (isSite) { //
|
|
||||||
return {
|
return {
|
||||||
presets: [
|
presets: [
|
||||||
'babel-preset-gatsby'
|
'babel-preset-gatsby'
|
||||||
|
@ -56,7 +53,8 @@ module.exports = api => {
|
||||||
development: isCommonJS
|
development: isCommonJS
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'@babel/preset-typescript'
|
'@babel/preset-typescript',
|
||||||
|
'babel-preset-gatsby'
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
'@babel/plugin-proposal-optional-chaining',
|
'@babel/plugin-proposal-optional-chaining',
|
||||||
|
@ -92,7 +90,7 @@ module.exports = api => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
isCDNBundle ? {} : [
|
isCDNBundle ? {} : [
|
||||||
'transform-import-styles',
|
'transform-import-styles'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// @see https://github.com/babel/babel/issues/8741#issuecomment-509041135
|
// @see https://github.com/babel/babel/issues/8741#issuecomment-509041135
|
||||||
|
@ -102,7 +100,7 @@ module.exports = api => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 按需引用 @see https://github.com/lodash/babel-plugin-lodash
|
// 按需引用 @see https://github.com/lodash/babel-plugin-lodash
|
||||||
'lodash',
|
'lodash'
|
||||||
// 内联 WebGL 常量 @see https://www.npmjs.com/package/babel-plugin-inline-webgl-constants
|
// 内联 WebGL 常量 @see https://www.npmjs.com/package/babel-plugin-inline-webgl-constants
|
||||||
// isCDNBundle ? 'inline-webgl-constants' : {}
|
// isCDNBundle ? 'inline-webgl-constants' : {}
|
||||||
],
|
],
|
||||||
|
|
|
@ -112,12 +112,11 @@
|
||||||
"worker-loader": "^2.0.0"
|
"worker-loader": "^2.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "NODE_ENV=site npm run site:develop",
|
"start": "npm run site:develop",
|
||||||
"build_site": "NODE_ENV=site npm run site:build",
|
"site:develop": "GATSBY=true gatsby develop --open -H 0.0.0.0",
|
||||||
"site:develop": "gatsby develop --open -H 0.0.0.0",
|
"site:build": "npm run site:clean && GATSBY=true gatsby build --prefix-paths",
|
||||||
"site:build": "npm run site:clean && NODE_ENV=site gatsby build --prefix-paths",
|
|
||||||
"site:clean": "gatsby clean",
|
"site:clean": "gatsby clean",
|
||||||
"site:deploy": "NODE_ENV=site npm run site:build && gh-pages -d public",
|
"site:deploy": "npm run site:build && gh-pages -d public",
|
||||||
"site:publish": "gh-pages -d public",
|
"site:publish": "gh-pages -d public",
|
||||||
"lint-fix:examples": "prettier --write examples/**/**/*.js",
|
"lint-fix:examples": "prettier --write examples/**/**/*.js",
|
||||||
"lint:site": "eslint examples/**/**/*.js --fix",
|
"lint:site": "eslint examples/**/**/*.js --fix",
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
export * from '@l7/core';
|
||||||
|
export * from '@l7/scene';
|
||||||
|
export * from '@l7/layers';
|
||||||
|
export * from '@l7/component';
|
||||||
|
//# sourceMappingURL=index.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAd;AAEA,cAAc,WAAd;AAEA,cAAc,YAAd;AAEA,cAAc,eAAd","sourcesContent":["export * from '@l7/core';\n// @ts-ignore\nexport * from '@l7/scene';\n// @ts-ignore\nexport * from '@l7/layers';\n// @ts-ignore\nexport * from '@l7/component';\n"],"file":"index.js"}
|
Loading…
Reference in New Issue