chore: migrate to ts-loader

This commit is contained in:
Roman Hotsiy 2018-03-17 15:11:52 +02:00
parent 598b3396ee
commit e27d421f8a
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
7 changed files with 83 additions and 48 deletions

View File

@ -42,7 +42,7 @@ export default {
use: [ use: [
'react-hot-loader/webpack', 'react-hot-loader/webpack',
{ {
loader: 'awesome-typescript-loader', loader: 'ts-loader',
options: { options: {
module: 'es2015', module: 'es2015',
}, },
@ -63,11 +63,11 @@ export default {
{ {
test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/, test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/,
use: { use: {
loader: 'awesome-typescript-loader', loader: 'ts-loader',
transpileOnly: true,
instance: 'ts2js-transpiler-only',
options: { options: {
transpileOnly: true,
allowJs: true, allowJs: true,
instance: 'ts2js-transpiler-only',
}, },
}, },
}, },

View File

@ -11,9 +11,9 @@ const webpackOptions = {
exclude: [/node_modules/], exclude: [/node_modules/],
use: [ use: [
{ {
loader: 'awesome-typescript-loader', loader: 'ts-loader',
options: { options: {
configFileName: 'e2e/tsconfig.json', configFile: 'e2e/tsconfig.json',
}, },
}, },
], ],

View File

@ -47,7 +47,6 @@
"@types/webpack": "^3.0.5", "@types/webpack": "^3.0.5",
"@types/webpack-env": "^1.13.0", "@types/webpack-env": "^1.13.0",
"@types/yargs": "^11.0.0", "@types/yargs": "^11.0.0",
"awesome-typescript-loader": "^3.2.2",
"babel-loader": "8.0.0-beta.2", "babel-loader": "8.0.0-beta.2",
"beautify-benchmark": "^0.2.4", "beautify-benchmark": "^0.2.4",
"conventional-changelog-cli": "^1.3.5", "conventional-changelog-cli": "^1.3.5",
@ -57,6 +56,7 @@
"enzyme": "^3.1.1", "enzyme": "^3.1.1",
"enzyme-adapter-react-16": "^1.0.4", "enzyme-adapter-react-16": "^1.0.4",
"enzyme-to-json": "^3.2.2", "enzyme-to-json": "^3.2.2",
"fork-ts-checker-webpack-plugin": "^0.4.1",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"jest": "^22.1.4", "jest": "^22.1.4",
"lodash": "^4.17.4", "lodash": "^4.17.4",
@ -72,6 +72,7 @@
"source-map-loader": "^0.2.1", "source-map-loader": "^0.2.1",
"style-loader": "^0.20.1", "style-loader": "^0.20.1",
"ts-jest": "^22.0.1", "ts-jest": "^22.0.1",
"ts-loader": "3",
"ts-node": "^4.1.0", "ts-node": "^4.1.0",
"tslint": "^5.7.0", "tslint": "^5.7.0",
"tslint-react": "^3.4.0", "tslint-react": "^3.4.0",

View File

@ -4,7 +4,7 @@ import * as React from 'react';
import { RecursiveLabel, TypeName, TypeTitle } from '../../common-elements/fields'; import { RecursiveLabel, TypeName, TypeTitle } from '../../common-elements/fields';
import { FieldDetails } from '../Fields/FieldDetails'; import { FieldDetails } from '../Fields/FieldDetails';
import { SchemaModel, FieldModel } from '../../services/models'; import { FieldModel, SchemaModel } from '../../services/models';
import { ArraySchema } from './ArraySchema'; import { ArraySchema } from './ArraySchema';
import { ObjectSchema } from './ObjectSchema'; import { ObjectSchema } from './ObjectSchema';

View File

@ -36,9 +36,5 @@
"./src/index.ts", "./src/index.ts",
"./src/standalone.tsx", "./src/standalone.tsx",
"demo/*.tsx" "demo/*.tsx"
], ]
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"useWebpackText": true
}
} }

View File

@ -1,5 +1,7 @@
import * as webpack from 'webpack'; import * as webpack from 'webpack';
import * as HtmlWebpackPlugin from 'html-webpack-plugin'; import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import * as path from 'path';
const nodeExternals = require('webpack-node-externals')({ const nodeExternals = require('webpack-node-externals')({
// bundle in moudules that need transpiling + non-js (e.g. css) // bundle in moudules that need transpiling + non-js (e.g. css)
@ -82,9 +84,11 @@ export default env => {
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
use: { use: {
loader: 'awesome-typescript-loader', loader: 'ts-loader',
options: { options: {
module: env.perf ? 'esnext' : 'es2015', compilerOptions: {
module: env.perf ? 'esnext' : 'es2015',
},
}, },
}, },
exclude: ['node_modules'], exclude: ['node_modules'],
@ -92,11 +96,13 @@ export default env => {
{ {
test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/, test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/,
use: { use: {
loader: 'awesome-typescript-loader', loader: 'ts-loader',
options: { options: {
transpileOnly: true,
allowJs: true,
instance: 'ts2js-transpiler-only', instance: 'ts2js-transpiler-only',
transpileOnly: true,
compilerOptions: {
allowJs: true,
},
}, },
}, },
}, },
@ -121,6 +127,7 @@ export default env => {
__REDOC_DEV__: env.prod ? 'false' : 'true', __REDOC_DEV__: env.prod ? 'false' : 'true',
}), }),
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
new ForkTsCheckerWebpackPlugin(),
], ],
}; };

View File

@ -678,18 +678,6 @@ autoprefixer@^6.3.1:
postcss "^5.2.16" postcss "^5.2.16"
postcss-value-parser "^3.2.3" postcss-value-parser "^3.2.3"
awesome-typescript-loader@^3.2.2:
version "3.5.0"
resolved "https://registry.yarnpkg.com/awesome-typescript-loader/-/awesome-typescript-loader-3.5.0.tgz#4d4d10cba7a04ed433dfa0334250846fb11a1a5a"
dependencies:
chalk "^2.3.1"
enhanced-resolve "3.3.0"
loader-utils "^1.1.0"
lodash "^4.17.4"
micromatch "^3.0.3"
mkdirp "^0.5.1"
source-map-support "^0.5.3"
aws-sign2@~0.6.0: aws-sign2@~0.6.0:
version "0.6.0" version "0.6.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f"
@ -1690,7 +1678,7 @@ cheerio@^1.0.0-rc.2:
lodash "^4.15.0" lodash "^4.15.0"
parse5 "^3.0.1" parse5 "^3.0.1"
chokidar@^1.6.0: chokidar@^1.6.0, chokidar@^1.7.0:
version "1.7.0" version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
dependencies: dependencies:
@ -2751,16 +2739,7 @@ encoding@^0.1.11:
dependencies: dependencies:
iconv-lite "~0.4.13" iconv-lite "~0.4.13"
enhanced-resolve@3.3.0: enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.3.0.tgz#950964ecc7f0332a42321b673b38dc8ff15535b3"
dependencies:
graceful-fs "^4.1.2"
memory-fs "^0.4.0"
object-assign "^4.0.1"
tapable "^0.2.5"
enhanced-resolve@^3.4.0:
version "3.4.1" version "3.4.1"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e"
dependencies: dependencies:
@ -3399,6 +3378,22 @@ forever-agent@~0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
fork-ts-checker-webpack-plugin@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-0.4.1.tgz#718801621c50c7f20de9c8e6a68a2db228a4081f"
dependencies:
babel-code-frame "^6.22.0"
chalk "^1.1.3"
chokidar "^1.7.0"
lodash.endswith "^4.2.1"
lodash.isfunction "^3.0.8"
lodash.isstring "^4.0.1"
lodash.startswith "^4.2.1"
minimatch "^3.0.4"
resolve "^1.5.0"
tapable "^1.0.0"
vue-parser "^1.1.5"
form-data@~2.1.1: form-data@~2.1.1:
version "2.1.4" version "2.1.4"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1"
@ -5058,10 +5053,22 @@ lodash.clonedeep@4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
lodash.endswith@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/lodash.endswith/-/lodash.endswith-4.2.1.tgz#fed59ac1738ed3e236edd7064ec456448b37bc09"
lodash.flattendeep@^4.4.0: lodash.flattendeep@^4.4.0:
version "4.4.0" version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"
lodash.isfunction@^3.0.8:
version "3.0.9"
resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051"
lodash.isstring@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
lodash.memoize@^4.1.2: lodash.memoize@^4.1.2:
version "4.1.2" version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
@ -5078,6 +5085,10 @@ lodash.sortby@^4.7.0:
version "4.7.0" version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
lodash.startswith@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/lodash.startswith/-/lodash.startswith-4.2.1.tgz#c598c4adce188a27e53145731cdc6c0e7177600c"
lodash.template@^4.0.2: lodash.template@^4.0.2:
version "4.4.0" version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0"
@ -5302,7 +5313,7 @@ micromatch@^2.1.5, micromatch@^2.3.11:
parse-glob "^3.0.4" parse-glob "^3.0.4"
regex-cache "^0.4.2" regex-cache "^0.4.2"
micromatch@^3.0.3, micromatch@^3.1.4: micromatch@^3.1.4:
version "3.1.9" version "3.1.9"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89"
dependencies: dependencies:
@ -5929,7 +5940,7 @@ parse5@4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
parse5@^3.0.1: parse5@^3.0.1, parse5@^3.0.3:
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c"
dependencies: dependencies:
@ -6951,7 +6962,7 @@ resolve@1.1.7:
version "1.1.7" version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2: resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2, resolve@^1.5.0:
version "1.5.0" version "1.5.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
dependencies: dependencies:
@ -7072,7 +7083,7 @@ selfsigned@^1.9.1:
dependencies: dependencies:
node-forge "0.7.1" node-forge "0.7.1"
"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: "semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
version "5.5.0" version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
@ -7356,7 +7367,7 @@ source-map-support@^0.4.15:
dependencies: dependencies:
source-map "^0.5.6" source-map "^0.5.6"
source-map-support@^0.5.0, source-map-support@^0.5.3: source-map-support@^0.5.0:
version "0.5.3" version "0.5.3"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76"
dependencies: dependencies:
@ -7697,10 +7708,14 @@ table@4.0.2:
slice-ansi "1.0.0" slice-ansi "1.0.0"
string-width "^2.1.1" string-width "^2.1.1"
tapable@^0.2.5, tapable@^0.2.7: tapable@^0.2.7:
version "0.2.8" version "0.2.8"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22"
tapable@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2"
tar-pack@^3.4.0: tar-pack@^3.4.0:
version "3.4.1" version "3.4.1"
resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f"
@ -7880,6 +7895,16 @@ ts-jest@^22.0.1:
pkg-dir "^2.0.0" pkg-dir "^2.0.0"
yargs "^11.0.0" yargs "^11.0.0"
ts-loader@3:
version "3.5.0"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-3.5.0.tgz#151d004dcddb4cf8e381a3bf9d6b74c2d957a9c0"
dependencies:
chalk "^2.3.0"
enhanced-resolve "^3.0.0"
loader-utils "^1.0.2"
micromatch "^3.1.4"
semver "^5.0.1"
ts-node@^4.1.0: ts-node@^4.1.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-4.1.0.tgz#36d9529c7b90bb993306c408cd07f7743de20712" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-4.1.0.tgz#36d9529c7b90bb993306c408cd07f7743de20712"
@ -8178,6 +8203,12 @@ vm-browserify@0.0.4:
dependencies: dependencies:
indexof "0.0.1" indexof "0.0.1"
vue-parser@^1.1.5:
version "1.1.6"
resolved "https://registry.yarnpkg.com/vue-parser/-/vue-parser-1.1.6.tgz#3063c8431795664ebe429c23b5506899706e6355"
dependencies:
parse5 "^3.0.3"
w3c-hr-time@^1.0.1: w3c-hr-time@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045"