fix webpack config ts issues

This commit is contained in:
Roman Hotsiy 2017-11-19 23:26:41 +02:00
parent 08034dc05f
commit f7374caf3c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
4 changed files with 16 additions and 10 deletions

View File

@ -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

View File

@ -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}\""

View File

@ -1,7 +1,6 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",
"target": "es5",
"noImplicitAny": false,

View File

@ -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',
}),