fix: fix usage with CRA by transpiling swagger2openapi deps

fixes #566
This commit is contained in:
Roman Hotsiy 2018-07-19 20:23:46 +03:00
parent cbfc226fa9
commit 6473e6269c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 10 additions and 3 deletions

View File

@ -106,6 +106,7 @@
"shelljs": "^0.8.1", "shelljs": "^0.8.1",
"source-map-loader": "^0.2.1", "source-map-loader": "^0.2.1",
"style-loader": "^0.21.0", "style-loader": "^0.21.0",
"swagger2openapi": "^3.2.8",
"ts-jest": "^23.0.0", "ts-jest": "^23.0.0",
"ts-loader": "4.4.2", "ts-loader": "4.4.2",
"ts-node": "^7.0.0", "ts-node": "^7.0.0",
@ -147,7 +148,6 @@
"slugify": "^1.2.1", "slugify": "^1.2.1",
"stickyfill": "^1.1.1", "stickyfill": "^1.1.1",
"styled-components": "^3.3.3", "styled-components": "^3.3.3",
"swagger2openapi": "^3.2.8",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"resolutions": { "resolutions": {

View File

@ -6,7 +6,14 @@ 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)
whitelist: ['swagger2openapi', /reftools/, /\.(?!(?:jsx?|json)$).{1,5}$/i], whitelist: [
'swagger2openapi',
/reftools/,
'oas-resolver',
'oas-kit-common',
'oas-schema-walker',
/\.(?!(?:jsx?|json)$).{1,5}$/i,
],
}); });
const VERSION = JSON.stringify(require('./package.json').version); const VERSION = JSON.stringify(require('./package.json').version);
@ -99,7 +106,7 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
exclude: ['node_modules'], exclude: ['node_modules'],
}, },
{ {
test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/, test: /node_modules\/(swagger2openapi|reftools|oas-resolver|oas-kit-common|oas-schema-walker)\/.*\.js$/,
use: { use: {
loader: 'ts-loader', loader: 'ts-loader',
options: { options: {