From 315c8ccf8290ab71f0f70a516cd094f9b593358b Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Fri, 22 Nov 2019 20:05:32 +0800 Subject: [PATCH] fix(babel): gatsby env --- babel.config.js | 12 +++++------- package.json | 9 ++++----- packages/l7/es/index.js | 5 +++++ 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 packages/l7/es/index.js diff --git a/babel.config.js b/babel.config.js index 5fd43d6eda..9cd7ba068b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -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' : {} ], diff --git a/package.json b/package.json index 2b03bbcc74..7f226caf61 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/l7/es/index.js b/packages/l7/es/index.js new file mode 100644 index 0000000000..b3b6ff4d42 --- /dev/null +++ b/packages/l7/es/index.js @@ -0,0 +1,5 @@ +export * from '@l7/core'; +export * from '@l7/scene'; +export * from '@l7/layers'; +export * from '@l7/component'; +//# sourceMappingURL=index.js.map \ No newline at end of file