mirror of https://gitee.com/antv-l7/antv-l7
fix(babel): gatsby env
This commit is contained in:
parent
23211d091d
commit
315c8ccf82
|
@ -1,14 +1,11 @@
|
|||
// @see https://babeljs.io/docs/en/next/config-files#project-wide-configuration
|
||||
module.exports = api => {
|
||||
api.cache(() => process.env.NODE_ENV);
|
||||
|
||||
const isSite = api.env('site');
|
||||
const isCDNBundle = api.env('bundle');
|
||||
const isCommonJS = api.env('cjs');
|
||||
const isESModule = api.env('esm');
|
||||
const isTest = api.env('test');
|
||||
|
||||
if (isSite) { //
|
||||
if (process.env.GATSBY === 'true') { //
|
||||
return {
|
||||
presets: [
|
||||
'babel-preset-gatsby'
|
||||
|
@ -56,7 +53,8 @@ module.exports = api => {
|
|||
development: isCommonJS
|
||||
}
|
||||
],
|
||||
'@babel/preset-typescript'
|
||||
'@babel/preset-typescript',
|
||||
'babel-preset-gatsby'
|
||||
],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-optional-chaining',
|
||||
|
@ -92,7 +90,7 @@ module.exports = api => {
|
|||
}
|
||||
],
|
||||
isCDNBundle ? {} : [
|
||||
'transform-import-styles',
|
||||
'transform-import-styles'
|
||||
],
|
||||
[
|
||||
// @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
|
||||
'lodash',
|
||||
'lodash'
|
||||
// 内联 WebGL 常量 @see https://www.npmjs.com/package/babel-plugin-inline-webgl-constants
|
||||
// isCDNBundle ? 'inline-webgl-constants' : {}
|
||||
],
|
||||
|
|
|
@ -112,12 +112,11 @@
|
|||
"worker-loader": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=site npm run site:develop",
|
||||
"build_site": "NODE_ENV=site npm run site:build",
|
||||
"site:develop": "gatsby develop --open -H 0.0.0.0",
|
||||
"site:build": "npm run site:clean && NODE_ENV=site gatsby build --prefix-paths",
|
||||
"start": "npm run site:develop",
|
||||
"site:develop": "GATSBY=true gatsby develop --open -H 0.0.0.0",
|
||||
"site:build": "npm run site:clean && GATSBY=true gatsby build --prefix-paths",
|
||||
"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",
|
||||
"lint-fix:examples": "prettier --write examples/**/**/*.js",
|
||||
"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
|
Loading…
Reference in New Issue