Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]: chore(*): publish es versions of browser packages #12761

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions packages/babel-preset-gatsby-package/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
const r = require(`./resolver`)

function preset(context, options = {}) {
const { browser = false, debug = false, nodeVersion = `8.0` } = options
const modernConfig = {
loose: true,
targets: {
esmodules: true,
},
useBuiltIns: false,
}

function preset(_, options = {}) {
const { browser = false, debug = false, nodeVersion = `8.0`, modern = process.env.MODERN } = options
const { NODE_ENV, BABEL_ENV } = process.env

const PRODUCTION = (BABEL_ENV || NODE_ENV) === `production`

const browserConfig = {
const browserConfig = modern ? modernConfig : {
useBuiltIns: false,
targets: {
browsers: PRODUCTION
Expand All @@ -31,7 +39,7 @@ function preset(context, options = {}) {
debug: !!debug,
useBuiltIns: `entry`,
shippedProposals: true,
modules: `commonjs`,
modules: modern ? false : `commonjs`,
},
browser ? browserConfig : nodeConfig
),
Expand All @@ -42,9 +50,8 @@ function preset(context, options = {}) {
plugins: [
r(`@babel/plugin-proposal-class-properties`),
r(`@babel/plugin-proposal-optional-chaining`),
r(`@babel/plugin-transform-runtime`),
r(`@babel/plugin-syntax-dynamic-import`),
],
].concat(modern ? [] : r(`@babel/plugin-transform-runtime`))
}
}

Expand Down
5 changes: 0 additions & 5 deletions packages/gatsby-image/.babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions packages/gatsby-image/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*.js
/*.mjs
/*.map
/withIEPolyfill/*.js
yarn.lock
10 changes: 6 additions & 4 deletions packages/gatsby-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"prop-types": "^15.6.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-preset-gatsby-package": "^0.2.0",
"cross-env": "^5.1.4",
"microbundle": "0.12.0-next.3",
"react-testing-library": "^5.0.0"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-image#readme",
Expand All @@ -26,10 +25,13 @@
],
"license": "MIT",
"main": "index.js",
"module": "index.modern.mjs",
"source": "src/index.js",
"repository": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-image",
"scripts": {
"build": "babel src --out-dir . --ignore **/__tests__",
"build": "microbundle --format modern,cjs --external react,react-dom,prop-types",
"build:polyfill": "microbundle --entry src/withIEPolyfill/index.js --output withIEPolyfill --format modern --external react,react-dom,prop-types",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__"
"watch": "microbundle watch"
}
}
6 changes: 0 additions & 6 deletions packages/gatsby-link/.babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions packages/gatsby-link/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/*.js
/*.mjs
/*.map
/__tests__
9 changes: 5 additions & 4 deletions packages/gatsby-link/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"prop-types": "^15.6.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-preset-gatsby-package": "^0.2.0",
"cross-env": "^5.1.4",
"microbundle": "0.12.0-next.3",
"react-testing-library": "^5.0.0"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-link#readme",
Expand All @@ -24,6 +23,8 @@
],
"license": "MIT",
"main": "index.js",
"module": "index.modern.mjs",
"source": "src/index.js",
"peerDependencies": {
"@reach/router": "^1.1.1",
"gatsby": "^2.0.0",
Expand All @@ -32,9 +33,9 @@
},
"repository": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-link",
"scripts": {
"build": "babel src --out-dir . --ignore **/__tests__",
"build": "microbundle --format modern,cjs --external react,react-dom,prop-types",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__"
"watch": "microbundle watch"
},
"types": "index.d.ts"
}
Loading