Skip to content

Commit

Permalink
feat: 进一步完善 corejs3
Browse files Browse the repository at this point in the history
  • Loading branch information
imsunhao committed Sep 24, 2019
1 parent 73c489a commit 54fe645
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 32 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"copy-webpack-plugin": "^5.0.4",
"cross-env": "^5.2.0",
"lodash": "^4.17.15",
"typescript": "^3.1.6",
"typescript": "^3.6.3",
"vue": "^2.6.10",
"vue-loader": "^15.4.2",
"vue-router": "^3.0.1",
Expand Down Expand Up @@ -116,6 +116,8 @@
"consola": "2.2.4",
"cookie-parser": "^1.4.3",
"core-js": "3",
"core-js-bundle": "3",

This comment has been minimized.

Copy link
@codler

codler Oct 25, 2019

You can use care-js-bundle to get less noise during npm install

"core-js-pure": "3",

This comment has been minimized.

Copy link
@codler

codler Oct 25, 2019

You can use care-js-pure to get less noise during npm install

"css-loader": "^1.0.1",
"es6-promise": "^4.2.5",
"express": "^4.17.1",
Expand Down
1 change: 1 addition & 0 deletions packages/start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"npm": ">=5.0.0"
},
"dependencies": {
"@babel/runtime-corejs3": "^7.6.2",
"base64url": "^3.0.1",
"compression": "^1.7.3",
"consola": "2.2.4",
Expand Down
30 changes: 18 additions & 12 deletions packages/start/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# yarn lockfile v1


"@babel/runtime-corejs3@^7.6.2":
version "7.6.2"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.6.2.tgz#032d0ca5107747751bb31cbce2302f9a73bd824c"
integrity sha512-FX1ddj2gf7psgslvkkKeyxftnslUFDY9OHGnp+wJ+4JIKSEABB1fKVZiE7/2n+C9RVTPfPwpOqGmFf5TGvg0Bw==
dependencies:
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.2"

accepts@~1.3.5, accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
Expand Down Expand Up @@ -306,6 +314,11 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=

core-js-pure@^3.0.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.2.1.tgz#879a23699cff46175bfd2d09158b5c50645a3c45"
integrity sha512-+qpvnYrsi/JDeQTArB7NnNc2VoMYLE1YSkziCDHgjexC2KH7OFiGhLUd3urxfyWmNjSwSW7NYXPWHMhuIJx9Ow==

dayjs@^1.7.7:
version "1.8.16"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.16.tgz#2a3771de537255191b947957af2fd90012e71e64"
Expand Down Expand Up @@ -563,13 +576,6 @@ glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"

globals@^12.1.0:
version "12.1.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-12.1.0.tgz#ce672adc93cb3303513ec62b5b97bad510db028f"
integrity sha512-GQ4xcAfbMWx/Lly8PUHIn8/t2o7YEoMWnQ7nhJtjEJ1gs8I4Y+koc0GiraVMaSjc9Ghz99obkMau/tSK/ACEsQ==
dependencies:
type-fest "^0.6.0"

has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
Expand Down Expand Up @@ -1065,6 +1071,11 @@ raw-body@2.4.0:
iconv-lite "0.4.24"
unpipe "1.0.0"

regenerator-runtime@^0.13.2:
version "0.13.3"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==

regex-not@^1.0.0, regex-not@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"
Expand Down Expand Up @@ -1332,11 +1343,6 @@ type-fest@^0.5.2:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2"
integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==

type-fest@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b"
integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==

type-is@~1.6.17, type-is@~1.6.18:
version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
Expand Down
14 changes: 12 additions & 2 deletions src/config/webpack.config.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ import webpack from 'webpack'
import merge from 'webpack-merge'
import { getCommonConfig } from './webpack.common.config'

const babelLoder = {
export const babelLoder = {
loader: 'babel-loader',
options: {
presets: [['latest-node', { target: 'current' }]]
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current'
},
corejs: { version: 3 }
}
]
]
}
}

Expand Down
8 changes: 1 addition & 7 deletions src/config/webpack.extensions.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import merge from 'webpack-merge'
import nodeExternals from 'webpack-node-externals'
import webpack from 'webpack'
import consola from 'consola'
import { babelLoder } from './webpack.config.config'
import { getCommonConfig } from './webpack.common.config'

export function getExtensionsConfig(
Expand All @@ -24,13 +25,6 @@ export function getExtensionsConfig(
return process.exit(1)
}

const babelLoder = {
loader: 'babel-loader',
options: {
presets: [['latest-node', { target: 'current' }]]
}
}

let resolve = {}
if (options.webpack.server && options.webpack.server.resolve) {
resolve = options.webpack.server.resolve
Expand Down
13 changes: 8 additions & 5 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { resolve } from 'path'
import { ConfigOptions, BuildService } from '@types'

import { getClientConfig, getServerConfig, getClientConfigSync } from 'src.config'
import {
getClientConfig,
getServerConfig,
getClientConfigSync
} from 'src.config'
import { existsSync, readFileSync } from 'fs'
import consola from 'consola'
import { createResolve } from 'src/utils/path'
Expand Down Expand Up @@ -115,7 +119,8 @@ export function setBabelrc(options: ConfigOptions.options) {
[
'@babel/plugin-transform-runtime',
{
helpers: false
helpers: false,
corejs: 3
}
],
'@babel/plugin-syntax-flow',
Expand Down Expand Up @@ -170,9 +175,7 @@ export function setPublicPath(rootDir, path) {
process.env.PUBLIC_PATH = path
}

function baseSetWebpack(
options: ConfigOptions.options
) {
function baseSetWebpack(options: ConfigOptions.options) {
options.webpack.server = getServerConfig(options)
// const isProduction = mode ? mode !== 'development' : true
// if (!isProduction) {
Expand Down
15 changes: 10 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,12 @@ copy-webpack-plugin@^5.0.4:
serialize-javascript "^1.7.0"
webpack-log "^2.0.0"

core-js-pure@^3.0.0:
core-js-bundle@3:
version "3.2.1"
resolved "https://registry.yarnpkg.com/core-js-bundle/-/core-js-bundle-3.2.1.tgz#264f563b51583179ebc8f180d7741c31b2e055e5"
integrity sha512-VbfmL66EqXkVDImfpK+kdxtvvb/IosyOmF18bOD1WHnOTPOBtS6VYV/Tgh3C2pIATTrEfM8UA3rsGIHiUUQV3A==

core-js-pure@3, core-js-pure@^3.0.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.2.1.tgz#879a23699cff46175bfd2d09158b5c50645a3c45"
integrity sha512-+qpvnYrsi/JDeQTArB7NnNc2VoMYLE1YSkziCDHgjexC2KH7OFiGhLUd3urxfyWmNjSwSW7NYXPWHMhuIJx9Ow==
Expand Down Expand Up @@ -7042,10 +7047,10 @@ typedarray@^0.0.6:
resolved "http://registry.npm.taobao.org/typedarray/download/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^3.1.6:
version "3.1.6"
resolved "http://registry.npm.taobao.org/typescript/download/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68"
integrity sha1-tlQ6g8/Iwr77P0yPumiW9bDJvmg=
typescript@^3.6.3:
version "3.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da"
integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==

uglify-es@^3.3.4:
version "3.3.9"
Expand Down

0 comments on commit 54fe645

Please sign in to comment.