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

Use Babel 7.x; Extract "babel" package; Update "browsers" default #639

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions packages/cli/lib/lib/webpack/transform-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ module.exports = async function (env, config, ssr=false) {
throw new Error(`preact-cli config could not be loaded!\nFile ${env.config} not found.`);
}

// allow ESM-based `preact.config.js` files
require('@babel/register')({
presets: [[require.resolve('@babel/preset-env'), {
"targets": { "node": "current" }
}]]
});

const m = require(myConfig);
const transformer = m && m.default || m;
try {
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
},
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>/tests/setup.js",
"moduleDirectories": [
"node_modules",
"../babel/node_modules"
],
"testEnvironment": "node"
},
"engines": {
Expand Down Expand Up @@ -46,6 +50,7 @@
},
"dependencies": {
"@babel/core": "^7.0.0",
"@babel/register": "^7.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about @babel/preset-env? 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Babel package

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see what you're saying. It'd resolve but will add to be safe

"@preact/babel": "*",
"autoprefixer": "^8.4.1",
"babel-esm-plugin": "^0.2.1",
Expand Down
30 changes: 28 additions & 2 deletions packages/cli/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0.tgz#697655183394facffb063437ddf52c0277698775"

"@babel/register@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827"
dependencies:
core-js "^2.5.7"
find-cache-dir "^1.0.0"
home-or-tmp "^3.0.0"
lodash "^4.17.10"
mkdirp "^0.5.1"
pirates "^4.0.0"
source-map-support "^0.5.9"

"@babel/template@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80"
Expand Down Expand Up @@ -1399,7 +1411,7 @@ copy-webpack-plugin@^4.1.0:
p-limit "^1.0.0"
serialize-javascript "^1.4.0"

core-js@^2.4.0, core-js@^2.5.0:
core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.7:
version "2.5.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"

Expand Down Expand Up @@ -2808,6 +2820,10 @@ home-or-tmp@^2.0.0:
os-homedir "^1.0.0"
os-tmpdir "^1.0.1"

home-or-tmp@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb"

hosted-git-info@^2.1.4:
version "2.7.1"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
Expand Down Expand Up @@ -4506,6 +4522,10 @@ node-libs-browser@^2.0.0:
util "^0.10.3"
vm-browserify "0.0.4"

node-modules-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"

node-notifier@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea"
Expand Down Expand Up @@ -5067,6 +5087,12 @@ pinkie@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"

pirates@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.0.tgz#850b18781b4ac6ec58a43c9ed9ec5fe6796addbd"
dependencies:
node-modules-regexp "^1.0.0"

pkg-dir@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"
Expand Down Expand Up @@ -6253,7 +6279,7 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"

source-map-support@^0.5.0:
source-map-support@^0.5.0, source-map-support@^0.5.9:
version "0.5.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
dependencies:
Expand Down