From f7374caf3c525ad9639df4bd610ddc347067bc85 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 19 Nov 2017 23:26:41 +0200 Subject: [PATCH] fix webpack config ts issues --- .travis.yml | 1 - package.json | 4 ++-- tsconfig.json | 1 - webpack.config.ts | 20 ++++++++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index b18ad306..97186433 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ env: addons: chrome: stable cache: yarn -before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi before_script: npm run bundle deploy: - provider: npm diff --git a/package.json b/package.json index 86e8287c..2292bb67 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "e2e:clean": "rimraf e2e/.build", "cy:open": "cypress open", "bundle:clean": "rimraf bundles", - "bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod ", - "bundle:lib": "webpack -p --env.lib --env.prod ", + "bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod", + "bundle:lib": "webpack -p --env.lib --env.prod", "bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone", "stats": "webpack -p --env.prod --json --profile > stats.json", "prettier": "prettier --write \"src/**/*.{ts,tsx}\"" diff --git a/tsconfig.json b/tsconfig.json index 1f29a13d..8c83c6e2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "experimentalDecorators": true, - "module": "es2015", "moduleResolution": "node", "target": "es5", "noImplicitAny": false, diff --git a/webpack.config.ts b/webpack.config.ts index 03eb983e..ba30b726 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,4 +1,4 @@ -import webpack from 'webpack'; +import * as webpack from 'webpack'; import * as HtmlWebpackPlugin from 'html-webpack-plugin'; import * as nodeExternals from 'webpack-node-externals'; @@ -54,7 +54,15 @@ export default env => { rules: [ { test: /\.tsx?$/, - loaders: ['react-hot-loader/webpack', 'awesome-typescript-loader'], + use: [ + 'react-hot-loader/webpack', + { + loader: 'awesome-typescript-loader', + options: { + module: 'es2015', + }, + }, + ], exclude: ['node_modules'], }, { @@ -89,7 +97,7 @@ export default env => { }; if (env.prod) { - config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin()); + config.plugins!.push(new webpack.optimize.ModuleConcatenationPlugin()); } if (env.lib) { @@ -98,10 +106,10 @@ export default env => { whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i], }); - config.output.library = 'Redoc'; - config.output.libraryTarget = 'umd'; + config.output!.library = 'Redoc'; + config.output!.libraryTarget = 'umd'; } else { - config.plugins.push( + config.plugins!.push( new HtmlWebpackPlugin({ template: './demo/playground/index.html', }),