Skip to content

Commit

Permalink
fix: use tslib for node pkgs as possible, add tsconfig.prod.json support
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Oct 29, 2019
1 parent 1b312af commit ed49383
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"ts-node": "^8.4.1",
"tslint": "^5.20.0",
"type-coverage": "^2.3.0",
"typescript": "~3.6.4",
"typescript": "~3.5.3",
"vue": "^2.6.10",
"vue-template-compiler": "^2.6.10",
"zone.js": "^0.10.2"
Expand Down
3 changes: 2 additions & 1 deletion packages/imagemin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"imagemin-upng": "^1.3.0",
"imagemin-webp": "^5.1.0",
"is-glob": "^4.0.1",
"tiny-glob": "^0.2.6"
"tiny-glob": "^0.2.6",
"tslib": "^1.10.0"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 0 additions & 1 deletion packages/imagemin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "@1stg/tsconfig/node",
"compilerOptions": {
"composite": true,
"importHelpers": false,
"rootDir": "src",
"outDir": "lib"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-url": "^3.0.0"
"rollup-plugin-url": "^3.0.0",
"tslib": "^1.10.0"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 0 additions & 1 deletion packages/rollup/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "@1stg/tsconfig/node",
"compilerOptions": {
"composite": true,
"importHelpers": false,
"rootDir": "src",
"outDir": "lib"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"dependencies": {
"chalk": "^2.4.2",
"cross-spawn": "^7.0.1",
"open": "^7.0.0"
"open": "^7.0.0",
"tslib": "^1.10.0"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 0 additions & 1 deletion packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "@1stg/tsconfig/node",
"compilerOptions": {
"composite": true,
"importHelpers": false,
"rootDir": "src",
"outDir": "lib"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@babel/core": "^7.6.4",
"@hot-loader/react-dom": "^16.10.2",
"@mdx-js/loader": "^1.5.1",
"@ngtools/webpack": "^8.3.14",
"@ngtools/webpack": "^8.3.15",
"@pkgr/es-modules": "^0.2.1",
"@pkgr/umd-globals": "^0.3.0",
"@pkgr/utils": "^0.1.2",
Expand Down Expand Up @@ -57,6 +57,7 @@
"stylus-loader": "^3.0.2",
"thread-loader": "^2.1.3",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslib": "^1.10.0",
"url-loader": "^2.2.0",
"vue-loader": "^15.7.1",
"vue-style-loader": "^4.1.2",
Expand Down
15 changes: 9 additions & 6 deletions packages/webpack/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
findUp,
identify,
isAngularAvailable,
isMdxAvailable,
isReactAvailable,
isTsAvailable,
isVueAvailable,
Expand Down Expand Up @@ -49,7 +48,7 @@ export interface ConfigOptions {
prod?: boolean
}

const tsconfigFile = tryFile([
let tsconfigFile = tryFile([
'tsconfig.app.json',
'tsconfig.base.json',
'tsconfig.json',
Expand Down Expand Up @@ -88,6 +87,10 @@ export default ({

const sourceMap = !prod

if (prod) {
tsconfigFile = tryFile('tsconfig.prod.json') || tsconfigFile
}

const baseBabelLoader = {
loader: 'babel-loader',
options: {
Expand Down Expand Up @@ -185,7 +188,7 @@ export default ({
'react-dom': '@hot-loader/react-dom',
}),
),
extensions: ['.ts', '.tsx', vue && '.vue', isMdxAvailable && '.mdx']
extensions: ['.ts', '.tsx', vue && '.vue', '.mdx']
.concat(EXTENSIONS)
.filter(identify),
plugins: [
Expand Down Expand Up @@ -222,7 +225,7 @@ export default ({
!/\.(mjs|jsx|tsx?|vue\.js)$/.test(file),
},
{
test: /\.mdx?$/,
test: /\.mdx$/,
use: babelLoader.concat('@mdx-js/loader'),
},
vue && {
Expand All @@ -238,7 +241,7 @@ export default ({
oneOf: cssLoaders('less'),
},
{
test: /\.s[a|c]ss$/,
test: /\.s[ac]ss$/,
oneOf: cssLoaders('sass'),
},
{
Expand All @@ -249,7 +252,7 @@ export default ({
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
oneOf: [
svgLoader && {
issuer: /\.[jt]sx?$/,
issuer: /\.m?[jt]sx?$/,
loader: svgLoader,
},
{
Expand Down
1 change: 0 additions & 1 deletion packages/webpack/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "@1stg/tsconfig/node",
"compilerOptions": {
"composite": true,
"importHelpers": false,
"rootDir": "src",
"outDir": "lib"
}
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
tslint-plugin-prettier "^2.0.1"
tslint-react "^4.1.0"

"@angular-devkit/core@8.3.14":
version "8.3.14"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-8.3.14.tgz#b42716a0de44c8f2785a18ae5562ec2f76543c9b"
integrity sha512-+IYLbtCxwIpaieRj0wurEXBzZ/fDSdWbyrCfajzDerzsxqghNcafAXSazHXWwISqtbr/pAOuqUNR+mEk2XBz3Q==
"@angular-devkit/core@8.3.15":
version "8.3.15"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-8.3.15.tgz#54629457e81c75952e6075d64214e2ada5e39efa"
integrity sha512-FYUYNcggvRm7glfmqsRgBA1N6ubkINVx2nquZZX10AeCIs4MRqlG4UsddFbOvVckIF/4Q+tBK5P/NngpP1zGXA==
dependencies:
ajv "6.10.2"
fast-json-stable-stringify "2.0.0"
Expand Down Expand Up @@ -2367,12 +2367,12 @@
call-me-maybe "^1.0.1"
glob-to-regexp "^0.3.0"

"@ngtools/webpack@^8.3.14":
version "8.3.14"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-8.3.14.tgz#ecac2651d2da7407f60acfb24ba03c460a79af1d"
integrity sha512-eIU3W3T4YxiExkS/c09FkqQpnKeIuUFFnxyfdG40zospt28B6V5ZaEVw2z5+2CjxJlDUTUYZlhPiV9Rwadp3jg==
"@ngtools/webpack@^8.3.15":
version "8.3.15"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-8.3.15.tgz#1b523e56693bc459accc734a0d9b93f3e1d1b6b2"
integrity sha512-eenlDUIlB1sjmNgioq2gFG2wt9rpgouQBOdjN/PKigglo4XvCPrJYN5XhcinL9Douy28HCTmPHo8+IjMgQChOA==
dependencies:
"@angular-devkit/core" "8.3.14"
"@angular-devkit/core" "8.3.15"
enhanced-resolve "4.1.0"
rxjs "6.4.0"
tree-kill "1.2.1"
Expand Down Expand Up @@ -16163,7 +16163,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@>=2.8.3, typescript@^3.4.3, typescript@~3.5.3, typescript@~3.6.4:
typescript@>=2.8.3, typescript@^3.4.3, typescript@~3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977"
integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==
Expand Down

0 comments on commit ed49383

Please sign in to comment.